4 ms·
Can you elaborate ? Which compiler flag is needed for compilation ?
by agnivade 8y ago
Can you elaborate ? Which compiler flag is needed for compilation ?
- giancarlostoro 8y agoSorry it wasn't a compiler flag, it was an environment variable. For Go modules if you don't have 'GO111MODULE' set to 'auto' or something appropriate, your code will whine about not being a module or something ridiculous. It will also cry about pulling in Go code with 'go get' if you don't have that environment variable properly configured.
- IshKebab 8y agoThe blog says that is only true if you put your code in GOPATH and the whole point of modules is that you don't need to do that.
- sethammons 8y agoRight, but anyone who is already using GOPATH for all their stuff now had to deal with this bizzare new flag. It was annoying for the few minutes it took me to realize what was going on and to fix it.
- agnivade 8y agoThe default value of that environment variable is auto. If you don't set anything, and you are inside GOPATH, module mode is disabled. If you are outside GOPATH, module mode is enabled. I think that is the most sane behavior. And this flag is needed because modules are an experimental feature. How else do you recommend to release experimental features ?
- giancarlostoro 8y agoIt wasn't auto in my case because I was getting errors till I defined it in Windows 10.
- agnivade 8y agoI mean that if it isn't set, the behavior is the same as auto. If you weren't getting "auto" behavior, then it's a bug. Please feel free to file an issue.