Level Up Your Web Apps With Go


Chapter 8 Gophr Part 5: Concurrency



Download 3,66 Mb.
Pdf ko'rish
bet7/37
Sana01.05.2022
Hajmi3,66 Mb.
#600662
1   2   3   4   5   6   7   8   9   10   ...   37
Bog'liq
level up your web apps with go

Chapter 8
Gophr Part 5: Concurrency
 . . . . . . . . . . 175
Goroutines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Waiting for Goroutines to Finish . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Communicating with Goroutines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
Communicating with Multiple Channels . . . . . . . . . . . . . . . . . . . . . . . . . 182
Using Channels and Selects for Timeouts . . . . . . . . . . . . . . . . . . . . 183
Looping on 
select
s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Throwing Away Goroutines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
Putting Goroutines into Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Using the Resized Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Chapter 9
Automated Testing
. . . . . . . . . . . . . . . . . . . . . 195
Writing Tests in Go . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
Passing and Failing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
Testing Multiple Variations of Inputs . . . . . . . . . . . . . . . . . . . . . . . . 198
Code Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Testing Between Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
Testing HTTP Requests and Responses . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
Testing the Gophr Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . 206
Testing Remote HTTP requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
Performance Benchmarking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Benchmark Regressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
xiii


Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216

Download 3,66 Mb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8   9   10   ...   37




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish