cmd/vet: add check for Context.WithValue(_, string, _) #17293
Closed
Labels
Milestone
Comments
I'd be happy to give this a try. |
Thanks. |
Submitted an initial CL here: https://go-review.googlesource.com/c/30084/. I suspect there's probably more I can do, but I would appreciate some review before I pursue this issue further. |
This is not a correctness issue and so should not be fixed in vet. It's a better candidate for lint. |
CL https://golang.org/cl/30084 mentions this issue. |
This was referenced Sep 30, 2016
Merged as golang/lint@c6242af |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Using a context.Context Value key of type
string
is a terrible idea and walks into the minefield of a global namespace. We should've outlawed it from day 1.All context value keys should be made from user-defined types.
Also disallow int, bool, etc. But string is what I usually see.
The text was updated successfully, but these errors were encountered: