Тёмный

Understanding Contexts in Go in 5(-ish?) Minutes 

TutorialEdge
Подписаться 29 тыс.
Просмотров 63 тыс.
50% 1

👨‍💻 For the price of $7.99 every month, sign up and gain access to a growing list of premium courses on my site - tutorialedge.n...
Welcome Gophers, in this video, we'll be covering the topic of contexts within Go and how you an use them to propagate key/values through your application and also to handle things like timeouts. If you prefer, the original text version of this article can be found here - tutorialedge.n...
✅ Subscribe and hit that 🔔 to get notified for all the latest tutorials!
🤓 / elliot_f
‎💻 tutorialedge.net
🎥 Recording Setup
Microphone - amzn.to/3hvASys
Mic Boom - amzn.to/3o0cW8Q
Mouse - amzn.to/2WZMoZs
Monitor 1 - amzn.to/38IUlYy
Monitor 2 - amzn.to/3rBTZf7
Mount - amzn.to/3o3185V
USB-C Hub - amzn.to/3o2xRbw

Опубликовано:

 

27 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 40   
@eduardozepeda1972
@eduardozepeda1972 2 года назад
I searched for tutorials about go's context and yours was the only one I understood. Thank you so much.
@fuadadio
@fuadadio 5 месяцев назад
Finally understood this concept. Thank you so much.
@adedoyinphilip8647
@adedoyinphilip8647 2 года назад
Thank you for this. Quite explanatory! 🙏
@Nuraddinhassan
@Nuraddinhassan 8 месяцев назад
your are my friend make my love golang, you are really great teacher, 😇🙂
@kevinkkirimii
@kevinkkirimii 8 месяцев назад
A question 10:40 is there need for the select case at line 35 since ctx.done() blocks and will be invoked once the timeout has exceeded ?!
@TomDoesTech
@TomDoesTech 2 года назад
So early it's still in 360p :) Great video!
@michaeldausmann6066
@michaeldausmann6066 2 года назад
good explanation. thanks.
@feynmaz
@feynmaz 2 года назад
Thank You. The tutorial is great!
@zawkhaled
@zawkhaled 2 года назад
Definitely removed some of the confusion!
@keivinc
@keivinc Год назад
thank you for the very good explanation 😀
@giridharanpasupathi
@giridharanpasupathi Год назад
Good explanation bro... ✔️
@gonzariosm
@gonzariosm 2 года назад
Great example, thanks a lot for the info :D
@PeterNunnOZ
@PeterNunnOZ 2 года назад
Good explination.
@Tutorialedge
@Tutorialedge 2 года назад
Thank you Peter! I hope you are keeping well!
@mwnkt
@mwnkt Год назад
i kinda understand context. though still not so clear.
@МаксимКамелевский-ъ8х
広めてください」、
@sorrowseal
@sorrowseal 2 года назад
Video is only 360p, too blurry.
@sorrowseal
@sorrowseal 2 года назад
All good now, youtube took longer than it used to.
@susiebaka3388
@susiebaka3388 Год назад
it took you 8 minutes to get to the context interface despite this being a tutorial on contexts in Go ...
@cariyaputta
@cariyaputta 2 года назад
Would you please cover the case of context use with grpc? Like how does the grpc lib make use of context, or how to use it for auth ...
@KoltPenny
@KoltPenny Год назад
I want my $0.00001 from the ads back 😆. Great video, keep it up.
@liang306
@liang306 2 месяца назад
Nicely explained. I like how the video started with "what and why", and give a brief overview of the concept!
@TechEats
@TechEats 2 года назад
This audio is not clear. would be great if you can add subtitles
@kumar-jatin-2000
@kumar-jatin-2000 7 месяцев назад
Really well made video. Thank you.
@HasanAYousef
@HasanAYousef 2 года назад
Great and simple, a side question, what is the theme you are using at VS code?
@clearlyajit
@clearlyajit 2 года назад
cobalt2 by wes bos
@m_205
@m_205 Год назад
It's very helpful. Thank you so much for the effort.
@nsevalkar
@nsevalkar Год назад
Can you share your emacs config?
@davidjdriver
@davidjdriver 8 месяцев назад
This is one part of go I really don't get. It hides dependencies inside a super parameter. If your method needs to know something it should be explicit or in scope of the struct as a base config. Putting values into a dictionary and passing the dictionary around hides the dependency. I don't understand how this became used in Go at all as it is actually an anti-pattern.
@Tutorialedge
@Tutorialedge 8 месяцев назад
I think there's a bit of a misunderstanding about the intent of context.Context here. You absolutely should not use it for things that are needed by the function, but the context may be used to pass extraneous information such as the request_id or trace_id that's currently being handled so that you can enrich logs/traces without polluting your function's logic and making it overly complex. If there are hard dependencies needed by your functions or methods, then these should be either passed in, or set on the struct that the method hangs off of.
@NateSelzer
@NateSelzer Месяц назад
​@@Tutorialedge I'm not sure how timeouts/deadlines fit into the "not needed by the function" category. Seems like critical functionality that functions should need to handle. For example, if you time out in the middle of a function that updates 2 different data sources with related information (let's say, a database entry that points to a file storage URL), the function would need to react to a timeout or this would result in data inconsistency.
@pb8655
@pb8655 Год назад
Wouldn’t it make sense to pass context by pointer?
@pb8655
@pb8655 Год назад
If go is copying by value, shouldn’t ctx.done lose reference to the outer scope
@garryhall9652
@garryhall9652 2 года назад
something that caused a little bit of confusion to me: the `
@adamburgess7890
@adamburgess7890 Год назад
Yeah this is no need for a select here :)
@DiegoGago
@DiegoGago 2 года назад
I've always wondered if sending information or adding logic via context is not a kind of hidden dependency in my code. Some people consider it a bad practice.
@klarnorbert
@klarnorbert 2 года назад
It is, and it shouldn't be used at all, according to Google.
@amitabhojha6117
@amitabhojha6117 2 года назад
​@@klarnorbert A citation would be great.
@elgs1980
@elgs1980 2 года назад
I don't think this should be part of the Go language.
@joshuatye1027
@joshuatye1027 2 месяца назад
This is basically the go community on everything.
Далее
Getting Started with Generics in Go
13:12
Просмотров 28 тыс.
How To Use The Context Package In Golang?
17:03
Просмотров 62 тыс.
Brilliant Budget-Friendly Tips for Car Painting!
00:28
Creating custom struct tags in Golang is awesome!
24:42
justforfunc #9: The Context Package
36:27
Просмотров 141 тыс.
Golang Channels Or Wait Groups? Let Me Explain.
18:32
Being Competent With Coding Is More Fun
11:13
Просмотров 79 тыс.