justforfunc #9: The Context Package

แชร์
ฝัง
  • เผยแพร่เมื่อ 30 ก.ย. 2024

ความคิดเห็น • 160

  • @rfgraham85
    @rfgraham85 7 ปีที่แล้ว +132

    5 minutes into the video and you've made more sense than the last 10 videos I've watched around Go concepts. Incredible approach to teaching while covering real world scenarios. Amazong job. Subbed!

    • @edwingarcia5043
      @edwingarcia5043 2 ปีที่แล้ว

      What makes you think that the other videos didn't help you to get ready for watching this one video? 🤔

    • @johnryan6020
      @johnryan6020 2 ปีที่แล้ว

      @@edwingarcia5043 That happens too, doesn't it. Great point (if not misplaced)!
      Most likely, it doesn't materially negate the effectiveness of Francesc's approach. It's a vector field and Rob seemed to clearly be using a short-hand to say, "damn, this vector has a magnitude and direction that helped me."

  • @ogreeni
    @ogreeni ปีที่แล้ว +11

    I’ve been learning go for less than a week, and just encountered your channel. Sad to see you no longer upload, these videos are really good.

  • @ozerbdy
    @ozerbdy 5 ปีที่แล้ว +15

    Very clear explanation, with mental leaps just at the right times. And also blending the real world use cases into the examples is very well thought of. Thank you!

    • @JustForFunc
      @JustForFunc  5 ปีที่แล้ว

      Wow, that's such a nice thing to say!
      Thanks 😊

  • @MiguelAngelLastYear
    @MiguelAngelLastYear 7 ปีที่แล้ว +16

    Priceless, as always.
    What about an episode about how to create applications that work at the same time on multiple servers, as a cluster? The guides I have seen are ambiguous and do not share the good practices they proclaim.
    That, or an episode about when it is recommendable to create gorutines and when not.
    Thank you, Francesc!

    • @JustForFunc
      @JustForFunc  7 ปีที่แล้ว +1

      +Miguel Ángel Jimeno Arce can you give an example? Do you mean something like a cluster database?

    • @MiguelAngelLastYear
      @MiguelAngelLastYear 7 ปีที่แล้ว +5

      JustForFunc yeah, a cluster database, a load balancer, a proxy to redirect http traffic, or a massive scanner which distributes traffic between available servers (my original idea was something pretty similar to this) and when it finalizes, joins results.
      Thank you!

  • @EnginDumlu
    @EnginDumlu 7 ปีที่แล้ว +9

    Thanks Frances, was a clear explanation.
    Can you please do the next episode about package initialization, sharing variables (like db / session) around between packages?

  • @markmcdonnell
    @markmcdonnell 7 ปีที่แล้ว +10

    thanks Frances, the quality of this video and its contents is exceptional :-)

  • @vbcv1
    @vbcv1 5 ปีที่แล้ว +6

    I wonder how many developers would recognise "modern bear" t-shirt. Thanks for fueling up my desire to learn Go! Woof 😋

  • @SaxonChuang
    @SaxonChuang 4 ปีที่แล้ว +2

    I have no idea about how the function sleepAndTalk know we cancelled

    • @KotBinary
      @KotBinary 4 ปีที่แล้ว +1

      I had the same question. So, I googled this: gist.github.com/astenmies/2f180213d310aa16b4b8c4e637be9441

    • @SaxonChuang
      @SaxonChuang 3 ปีที่แล้ว +1

      @@KotBinary thanks :)

  • @YBWang-pi9qq
    @YBWang-pi9qq 3 ปีที่แล้ว +2

    Amazing explanations with examples. One of the most talent instructors.
    Thanks you and keep doing it.

  • @davudsafarli5356
    @davudsafarli5356 4 ปีที่แล้ว +2

    Thank you! I don't understand why no one starts by giving simple example like you do

  • @Simon-xi8tb
    @Simon-xi8tb 2 ปีที่แล้ว +1

    where is the sleepAndTalk fn ?

  • @mohsanabbas6835
    @mohsanabbas6835 3 ปีที่แล้ว +1

    Best video on the topic. Thanks

  • @daveteare1960
    @daveteare1960 7 ปีที่แล้ว +4

    I really enjoyed this episode - thank you! I've seen context used a lot and never really understood it until now. ❤️

  • @UnknownStuff0417
    @UnknownStuff0417 4 ปีที่แล้ว +1

    Great video. A very important concept for setting up and handling things like timeouts and even exceptions in Go. I don't see this being addressed in other Go overview sites/videos. Really happy to come accross this.
    However, perhaps its just me but I don't think the last point/topic on sending value between "client.go" and "server.go" had appropriate phrasing from @justforfunc. I get his explanation for "foo" id to properly show up, the client has to include it as a header/body/uri-id as they are purely HTTP request data/communication. But that has nothing to do with inherently Go or even "context". I sort of interpreted this context as some internal "Go" communication between the client.go and server.go processes. And really the context in both client.go and server.go are between the those process' and operating system, but something like an HTTP client and server are really good examples to show where "context" is very applicable.
    Really good video but slightly misleading.

  • @sergeywhite8897
    @sergeywhite8897 4 ปีที่แล้ว +2

    Thank you, you're REALLY doing well. Thank you one more time!!!

  • @yeboahnanaosei
    @yeboahnanaosei 4 ปีที่แล้ว +1

    This video is my go to reference material on go's contexts. Thank you very much

  • @juliankandlhofer7553
    @juliankandlhofer7553 4 ปีที่แล้ว +1

    Great video! I watched 2 talkes before and was more confused about contexts after watching them.
    this video explained everything!

  • @Alfrednohike9909
    @Alfrednohike9909 ปีที่แล้ว

    Hi, I would love to hear from you, as someone with a lot of experience in Golang, do you think SOLID Principles important in practice, and in interviews? Would I be asked a lot of questions, and how would I go about that, considering that SOLID Principles are mostly OOP concepts, and Golang is not a real OOP language. I am also curious about the same for design patterns like Builder, Factory pattern etc

  • @kamal-xd7id
    @kamal-xd7id 7 ปีที่แล้ว +1

    Do you have any other example for context with value other than request id? It would be better to understand this concept if you can. Thanks!

  • @Jordan-kk5xj
    @Jordan-kk5xj 2 ปีที่แล้ว

    Regarding the ability for the HTTP client to "cancel" the request via the context which notifies the HTTP server, I assume this would only work with such a golang client and a golang server, correct? I.e. this is impossible with say a Java client and golang server, correct?

  • @lhpegz
    @lhpegz ปีที่แล้ว

    lets say about following the trace-id and span-id, both are probably good values for contexts right?

  • @luvpranay
    @luvpranay 2 ปีที่แล้ว

    Learning Golang from Bayer Mayfield. The best

  • @Filhodanuvem
    @Filhodanuvem 3 ปีที่แล้ว

    From time to time I come back here and watch a random video. It inspires me so much. Thank you.

  • @willhawkins7391
    @willhawkins7391 6 ปีที่แล้ว +1

    Francesc, I know this is an old Just for Func but I went back and watched it today and wanted to say Thanks! Great episode. As others have said, the explanation is perfect! Just what I needed. Thanks again and keep up the great work!

  • @aguiwang7876
    @aguiwang7876 2 ปีที่แล้ว

    I am big fan from China who watch your video every day before sleep! 😀

  • @kianyanglee4618
    @kianyanglee4618 5 หลายเดือนก่อน

    What's the != symbol at @15:46? Shouldn't it be !=?

  • @OfferoC
    @OfferoC 7 ปีที่แล้ว +1

    Nice vscode setup. Can you describe the exact set up somewhere in a post or video?

  • @Oswee
    @Oswee 6 ปีที่แล้ว

    I really, really, really would like to see complete series about how to create IDIOMATIC Client Server WEB application with most common CRUD operations using gRPC and MySQL. Client and Server should be just simple Go programs. Would like to see: IDIOMATIC Directory/File organization in context of github.com/myusername/. gRPC service interface, and message/+field idiomatic naming and organizing into packages. Package +nested package importing. Compiling nested .proto's. TLS secured gRPC communication. Idiomatic endpoint URL constructions. Context. Displaying in browser - single record, list of records, single record + list. Submitting form, updating record, creating nested records - like, when customer is created, also some log record in the same DB is created pointing to the same customer (tx). And so on so on.
    Basically, EVERY beginner want to see complete IDIOMATIC example of writing production ready basic DD web-page.
    Nobody is teaching this. 98% of tutorials and books teaching the easiest way - Just mess everything into main.go and use mock data! This is total BS! This is not how good things should be teached.
    It is much better when you see, how great foundation looks like and then starting to tweak, and to learn all those used patterns in details. When you have no context in head, it is impossible to learn right way. Iterating thru the trial & fail is way to learn for sure, but it is not the most effective! It just wastes too much human time.
    YES - this kind of tutorial will take time to record. But this will be the SINGLE PERFECT TUTORIAL in the whole f*g WEB.

  • @paragkamble
    @paragkamble 2 ปีที่แล้ว

    Thanks Very clear explanation.

  • @TylerShawful
    @TylerShawful 3 ปีที่แล้ว

    That poor plant in the background needs water

  • @matheusaraujo4495
    @matheusaraujo4495 2 ปีที่แล้ว

    Very nice explanation! Thanks

  • @ColmMalone
    @ColmMalone 4 ปีที่แล้ว

    Who's here from the Aug 20th Go Time podcast?
    BTW at 21:00 - since go1.13 - you can now do this in one call with: golang.org/pkg/net/http/#NewRequestWithContext

  • @kamal-xd7id
    @kamal-xd7id 7 ปีที่แล้ว

    Learned Context in one go, without even pausing a single sec. :) btw which editor you are using and i saw you have some template like hand -> f(w http.Responsewrite, r *http.Request), how to do it?

  • @faroukfaiz8396
    @faroukfaiz8396 2 ปีที่แล้ว

    This is some good quality content!

  • @jojoross
    @jojoross 4 ปีที่แล้ว

    useing a function (sllepAndTalk) you created for half of the video ,and not showing how that function worked was a waste of my time.
    thank you for frustrating me back to the doc.

  • @davidagyakwa288
    @davidagyakwa288 3 ปีที่แล้ว

    how to model go projects ...id be happy

  • @Waffle-ish
    @Waffle-ish 3 ปีที่แล้ว

    Disclaimer: kinda new to golang XD
    What do you mean by "defining a request without using tags?"

  • @ZenMonkIlya
    @ZenMonkIlya 2 ปีที่แล้ว

    Excellent explanation. This is very helpful. Thank you!

  • @derdere7803
    @derdere7803 ปีที่แล้ว

    I keep coming back to this video over time. It has a lot of value. Thanks for taking time and doing that. Where are you by the way, get back here and produce some more please.

  • @dmytro.tsapko
    @dmytro.tsapko 7 ปีที่แล้ว

    Hi, looks like using context.WithTimeout somehow tears down TCP half-connection from client to server, that's why you got context closed on the server side. I didn't get how it closes the half-connection. But the question is why context.WithCancel does not tear down TCP half-connection after invoking cancel() ?

  • @mehradsadeghi
    @mehradsadeghi 3 ปีที่แล้ว

    Thank you for this video.

  • @chimmychingo6703
    @chimmychingo6703 ปีที่แล้ว

    Loved this video. Watched a few that didnt quite get through, but this really brought into the right “context” xD

  • @batu266
    @batu266 3 ปีที่แล้ว

    Very helpful, thank you.

  • @jatinmohankapoor3250
    @jatinmohankapoor3250 2 ปีที่แล้ว

    with cancel is not working for me

  • @unknownknowns420
    @unknownknowns420 ปีที่แล้ว

    phenomenal explanation, thanks!

  • @raam_sevak
    @raam_sevak 6 ปีที่แล้ว

    I kept trying sending value with a context over the http to another machine, I stopped after I watched this video. Very detailed! I love your videos :D

  • @sayansikdar4385
    @sayansikdar4385 3 ปีที่แล้ว

    where can I find the codes which are written here?

  • @davidagyakwa288
    @davidagyakwa288 3 ปีที่แล้ว

    Deep dive in context ...id be glad

  • @vishalsh1624
    @vishalsh1624 2 ปีที่แล้ว

    Amazing explanation with real world examples. Thank you so much!

  • @jjrumi
    @jjrumi 7 ปีที่แล้ว

    T-h-a-n-k y-o-u.
    -------------------------
    I was really going to send you a message requesting exactly this :)
    Love your channel so far. Keep it up!!!!

  • @john_rambo_27098
    @john_rambo_27098 6 ปีที่แล้ว +1

    Beautiful, Excellent, Mind Blowing, Priceless

  • @BrutalHellfire
    @BrutalHellfire 6 ปีที่แล้ว

    Hi.. I really love to watch your videos. First video of you that I watched was "Go Tooling in Action", and That Was Awesome. That night I watched five of your videos, despite that I had to go to office next morning. They were really great.
    Now that I know, you review codes and even I can suggest one, I would really appreciate if you take a look at github.com/a4abhishek/CITF. It has created just a few days ago, so it is not yet ready to be reviewed by someone like you, but still I wanted to share this with you, so maybe after couple of weeks or in a month, you can actually review this. I will be waiting for that. Thanks. Keep teaching us.

  • @publicuser993
    @publicuser993 3 ปีที่แล้ว

    That's what i needed.
    BIG THANK YOU

  • @darrensapalo
    @darrensapalo 3 ปีที่แล้ว

    Incredible talk.

  • @GertCuykens
    @GertCuykens 7 ปีที่แล้ว

    Nice, learnt allot. PS can you also give the reason behind values not propagating like cancel please?

  • @mattmarshall1834
    @mattmarshall1834 3 ปีที่แล้ว

    Great video. I'd been reading about context this afternoon and this very much tied up some mental loose ends I still had.

  • @fuadolatunji9316
    @fuadolatunji9316 2 ปีที่แล้ว

    What vscode theme is this?

  • @DreammzShow
    @DreammzShow 4 ปีที่แล้ว

    Thank you for the great videos. This is really helpful.

  • @DineshGowda24
    @DineshGowda24 4 ปีที่แล้ว

    Thank you for this, this is amazing. I have read about context package, but couldn't really understand. But this 36 mins have been priceless. Very well done.

  • @newshatavakoli5960
    @newshatavakoli5960 3 ปีที่แล้ว

    Thanks for the great video. This video was just the right speed and amount of explanation that I needed, very to the point. Watching you code through the examples, I learned things other than the context package too.

  • @alfaex.
    @alfaex. 6 ปีที่แล้ว

    i read a lot of posts on medium and the GO blog about context and i was completely lost... with this video it was very easy to understand. Amazing job

  • @xcvsdxvsx
    @xcvsdxvsx 3 ปีที่แล้ว

    Thanks so much! 7 minutes in and I now understand what the code does that I was trying to decipher.

  • @johnbalvin5401
    @johnbalvin5401 6 ปีที่แล้ว

    how do I set up visual studio to add the package library while I writting code? I always need to do it for myself and is anoying

  • @susisorglos3215
    @susisorglos3215 7 ปีที่แล้ว

    Hey, very nice video! Could you make an episode about you vscode setup and the extensions you are using? Thanks!

  • @Danzlh
    @Danzlh 4 ปีที่แล้ว

    gooooooooooood shit

  • @trompelek
    @trompelek 3 ปีที่แล้ว

    like your tee!

  • @AbdulMannan-rv5yx
    @AbdulMannan-rv5yx 3 ปีที่แล้ว

    Really nice, clear my head lots on this package

  • @michalvyskocil
    @michalvyskocil 5 ปีที่แล้ว

    Hi, amazing stuff! I was still struggling on how to use context skimming the official docs. However this is simply awesome. Especially thanks for showing that you can't send context values across network.That would be stupid idea anyway :-)

  • @kewang1612
    @kewang1612 7 ปีที่แล้ว

    I was following along typing in another window and 13:51 scared the xxxx out of me... :)

  • @umeshdhaked1703
    @umeshdhaked1703 3 ปีที่แล้ว

    f awesome.

  • @keepondev
    @keepondev 4 ปีที่แล้ว

    Amazing explanation! thank you so much

  • @RamiAwar
    @RamiAwar 2 ปีที่แล้ว

    I love the preaching of good practices like not using the context to pass values unless absolutely necessary. This aligns with how I like to write code, even though I've seen other developers use context to pass non-request scoped data. This channel seems to be a hidden gem!

    • @RamiAwar
      @RamiAwar 2 ปีที่แล้ว

      Kind of got scared by the video length at first though, glad I watched it anyways.

  • @Ysonichero
    @Ysonichero 4 ปีที่แล้ว

    Thank you Frances, it’s really help me to understand context package.

  • @bathaivan4323
    @bathaivan4323 3 ปีที่แล้ว

    very helpful, thanks very much

  • @vishwa1581
    @vishwa1581 3 ปีที่แล้ว

    Thanks.

  • @zakariachahboun
    @zakariachahboun 2 ปีที่แล้ว

    Great experience! Thank you so much

  • @kauehmoreno8967
    @kauehmoreno8967 5 ปีที่แล้ว

    I got a doubt. When u write a handler with select case, context will be cancel only because your time.After are holding execution and than

    • @kauehmoreno8967
      @kauehmoreno8967 5 ปีที่แล้ว

      I got it!! It will be able to run on a different goroutine returning value and catch it into select statement

  • @ericnyamu5249
    @ericnyamu5249 4 ปีที่แล้ว

    thanks Thor.I now understand Go better

  • @tomah911
    @tomah911 6 ปีที่แล้ว

    I'm so glad I found your TH-cam channel ! This video is perfect to understand how to use the Context package, thx !

  • @vs4vijay
    @vs4vijay 4 ปีที่แล้ว

    One of the best explanation!!! Thanks.

  • @adnanrashid6743
    @adnanrashid6743 4 ปีที่แล้ว

    Really enjoyed the explanation, very clear 👍🏽

  • @alesresta
    @alesresta 7 ปีที่แล้ว

    I've been learning so much watching your videos! Thank you very much.

  • @phillippotter1359
    @phillippotter1359 4 ปีที่แล้ว

    Really helpful video, thank you dude, keep up the great work!

  • @chernovsergey23
    @chernovsergey23 3 ปีที่แล้ว

    That was very useful, thanks!

  • @nwjlions
    @nwjlions 7 ปีที่แล้ว

    Really informative video. Thanks Francesc.

  • @TheSoftEng
    @TheSoftEng 3 ปีที่แล้ว

    TH-cam give us a love reaction, pls: D

  • @codesworth
    @codesworth 7 ปีที่แล้ว

    This helped me understand the context package much better, thank you!

  • @capnnukasun810
    @capnnukasun810 4 ปีที่แล้ว

    thanks! really helped (at work)

  • @tanoybhowmick8715
    @tanoybhowmick8715 4 ปีที่แล้ว

    Please keep the good work up. So good.

  • @bargrz
    @bargrz 5 ปีที่แล้ว

    Subtitles on: 'Hi! I am Franciscan boy!' :p

  • @jayeshthamke7860
    @jayeshthamke7860 4 ปีที่แล้ว

    Exceptional work!

  • @TrueFurby
    @TrueFurby 6 ปีที่แล้ว

    Does any one else hear "just for fuck" in the beginning?

    • @JustForFunc
      @JustForFunc  6 ปีที่แล้ว +1

      I think it's just you ... and maybe the automated TH-cam subtitles

  • @SergeySaraev-xe4fl
    @SergeySaraev-xe4fl 7 ปีที่แล้ว

    Very Nice! Thatk you Francesc!

  • @AnhNguyen-vu7mc
    @AnhNguyen-vu7mc 6 ปีที่แล้ว

    Hey Francesco, huge thanks for your series of videos. was wondering if you can post the code repo on github

    • @JustForFunc
      @JustForFunc  6 ปีที่แล้ว

      +Anh Nguyen it's on GitHub.com/campoy/justforfunc

  • @sphaniy
    @sphaniy 6 ปีที่แล้ว

    Francesc, Did you do the episode on the internals of the context package?

    • @JustForFunc
      @JustForFunc  6 ปีที่แล้ว

      Yup, literally the episode after this one

  • @nolliepoper
    @nolliepoper 7 ปีที่แล้ว

    This was super helpful, thank you.

  • @redsnakeintown
    @redsnakeintown 5 ปีที่แล้ว

    Couldnt figure out what you did in the Decorate. I think I need some sleep..

    • @RandomShowerThoughts
      @RandomShowerThoughts 4 ปีที่แล้ว

      it was basically a middle ware which adds in a request id into the context and returns the next function as a call

  • @mehditorkamani9890
    @mehditorkamani9890 5 ปีที่แล้ว

    Amazing... Short and sweet!

  • @_slier
    @_slier 6 ปีที่แล้ว

    damn, is there any chance you are a Thor?

  • @JohnHAdams-vo2pk
    @JohnHAdams-vo2pk 4 ปีที่แล้ว

    Awesome!!!