Go request handlers typically include a “context” value as their first
argument:
func handler( ctx context.Context, ... ) {
...
}
In my experience, this convention is typically fastidiously followed, but
then nothing is ever done with that ctx
argument. What is it really
for? Unfortunately, the description in the official
Go package documentation
is a bit cryptic, and the type implementation itself does not reveal
anything either (the default context is just an empty struct).
Properly understood, it’s actually a really convenient idiom; however,
its value is not so much in the context
package itself, but in some
idioms in the code that use the package.