Learning Golang: Context package: Cancellations, Deadlines and Request-scoped values



Learning Golang: Context package: Cancellations, Deadlines and Request-scoped values

Learning Golang: Context package: Cancellations, Deadlines and Request-scoped values

Welcome! Let’s learn and talk about the context package, specifically about how to implement deadlines, cancellation and request-scoped values using the functions defined in the package:

* context.WithDeadline and context.WithTimeout
* context.WithCancel and
* context.WithValues

The code is available here: https://github.com/MarioCarrion/videos/tree/563b41660420a5e77d25157f1d4798f343d12d22/2021/05/07

* Blog: https://mariocarrion.com/2021/05/31/learning-golang-context-package.html

* Previous Episode: “Golang Microservices: Events and Background Jobs using RabbitMQ”: https://youtu.be/L0yJxCKrkIY
* Playlist “Building Microservices in Go/Golang”: https://www.youtube.com/playlist?list=PL7yAAGMOat_Fn8sAXIk0WyBfK_sT1pohu
* Playlist “Golang Tools and Packages”: https://www.youtube.com/playlist?list=PL7yAAGMOat_HEEOvH99agDs_5g51A0Ls3
* Playlist “Testing in Go”: https://www.youtube.com/playlist?list=PL7yAAGMOat_HSeW4zF0uRL9EaHadE4ZZq

00:00 Intro
00:56 What is the context package?
01:19 Context Deadlines
04:06 Cancellation Signals
07:32 Request-scoped values
10:02 Best practices
11:17 Parting words

Who am I:

HelloπŸ‘‹πŸΌ! I’m Mario, a Hands-on Software Architect and Lead Backend Engineer with more than 16 years of professional experience building all kinds of software including on-premise Industrial Automation Systems, Linux Accessibility Desktop and Browser Components as well as Distributed Advertising Microservices.

Every week I will share with you different topics I’ve learned while working for small startups and large companies including the processes I’ve followed over the years for successfully delivering complex enterprise systems from start to end.

Subscribe if you like Software Development, Software Architecture and Systems Design!

Keep it up. Don’t give up!

#golang #microservices #programming

— Our affiliate links below

Shop our favorite products β†’ https://www.amazon.com/shop/rubycarrion
Vlogging setup β†’ https://rubycarrion.com/camerasforvlogging/
Get a 30 day FREE trial of Epidemic Sound β†’ https://www.epidemicsound.com/referral/szx441/
Try Amazon Prime 30-Day FREE trial β†’ https://amzn.to/3s0el1R
I love getting Cash Back and think you will too! Join for free and get $20 when you spend $20 β†’ https://www.rakuten.com/r/RUBYRA132?eeid=28187
Sign up to start using vidIQ to grow your YouTube channel for FREE β†’ https://vidiq.com/rubycarrion

— Our Vlog Channel

https://www.youtube.com/c/RubyCarrion/videos

Comments are closed.