this post was submitted on 10 Jun 2024
12 points (100.0% liked)
Golang
2201 readers
6 users here now
This is a community dedicated to the go programming language.
Useful Links:
Rules:
- Posts must be relevant to Go
- No NSFW content
- No hate speech, bigotry, etc
- Try to keep discussions on topic
- No spam of tools/companies/advertisements
- It’s OK to post your own stuff part of the time, but the primary use of the community should not be self-promotion.
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
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