AI-powered
podcast player
Listen to all your favourite podcasts with AI-powered features
Go Code - The Context Package
The context package, it defines an interface and part of the interface is that you can cancel the context. So what's new in Go 1.20 is now there's context with cancel cause and that will tell you why something was canceled. The main use of the context type in Go is to define deadlines. You can say, I want this request to try to go in the next two seconds. And if it doesn't get done in two seconds, just give up and abort because by then the user will have already pressed back and gone away.