Putting Go's Context package into context (blog.meain.io)
from jamietanna@programming.dev to golang@programming.dev on 10 Jun 2024 06:50
https://programming.dev/post/15317256

#golang

threaded - newest

kamstrup@programming.dev on 10 Jun 2024 13:00 collapse

The context package is such a big mistake. But at this point we just have to live with it and accept our fate because it’s used everywhere

It adds boilerplate everywhere, is easily misused, can cause resource leaks, has highly ambiguous conotations for methods that take a ctx: Does the function do IO? Is it cancellable? What transactional semantics are there if you cancel the context during method execution.

Almost all devs just blindly throw it around without thinking about these things

And dont get me startet on all the ctx.Value() calls that traverse a linked list