Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/vet: help prevent copying of mutexes #6729
go vet feature request: If a method has a value receiver, and the receiver type contains (directly or indirectly) an object from the sync package, warn about possible copying of a sync primitive. For example, in http://play.golang.org/p/5he6Ts-XgK, go vet would complain about the method Bad. This would have saved me several painful hours yesterday.
...and I took a quick look at implementing this. It looks non-trivial, unfortunately, since go vet would need to know about the types involved, and that's not handy based on just an AST walk. Might future go vet implementations share a backend with the go oracle, to enable deeper checks like this?
This issue was closed.