3 ms·
You should use go vet https://golang.org/cmd/vet/#hdr-Struct_tags https://golang.org/cmd/vet/#hdr-Struct_tags (There seems to be a documentation error.) And
by Jabbles 10y ago
You should use go vet
https://golang.org/cmd/vet/#hdr-Struct_tags https://golang.org/cmd/vet/#hdr-Struct_tags
(There seems to be a documentation error.)
And try the race detector:
https://golang.org/doc/articles/race_detector.html https://golang.org/doc/articles/race_detector.html
Though of course, it's hard to argue that it would be nice to prevent these from compiling.
- dispose13432 10y agoWell, that's an "easy" bug. What about not-shadowing a "non-loop" variable? Take a look at this question: http://stackoverflow.com/questions/18499352/golang-cuncurrency-how-to-append-to-the-same-slice-from-different-goroutines http://stackoverflow.com/questions/18499352/golang-cuncurren... It's easy to mess up during refactoring, and there's pretty much no reason to allow it.
- lobster_johnson 10y agoIndeed, it's invaluable. I use "go vet" and have enabled all of the Gometalinter linters [1] that make sense. "go vet" never warned me about goroutine closure errors, not sure why, maybe I was running an old version. But I'm glad that it's supported. That said, some of the things that "go vet" catches should, in my opinion, be errors. [1] https://github.com/alecthomas/gometalinter https://github.com/alecthomas/gometalinter