2 ms·
Not any personal hostility. Rather [0]: > 1) ... The $GOPATH provides us with a place to store common, shared third party libs on our system, and our own proje
by shakna 10y ago
Not any personal hostility. Rather [0]:
> 1) ... The $GOPATH provides us with a place to store common, shared third party libs on our system, and our own projects.
> #1 is the correct and supported way. The other methods are actively discouraged. Andrew.
But, for example, the documentation for GOPATH makes no suggestion it is even possible [1]:
> GOPATH must be set to get, build and install packages outside the standard Go tree.
> Each directory listed in GOPATH must have a prescribed structure:
And the compiler help says:
> Build adheres to certain conventions such as those described by 'go help gopath'.
It's exciting that I've been mislead about the ease of this, but I wouldn't say it is well explained in the docs.
The team want one true way of building a go pkg.
[0] https://groups.google.com/forum/#!topic/golang-nuts/dxOFYPpJEXo https://groups.google.com/forum/#!topic/golang-nuts/dxOFYPpJ...
[1] https://golang.org/cmd/go/#hdr-GOPATH_environment_variable https://golang.org/cmd/go/#hdr-GOPATH_environment_variable
- laumars 10y agoI don't really know how to respond because I found the answers you wanted by looking briefly in the docs. > But, for example, the documentation for GOPATH makes no suggestion it is even possible [1] Well to be fair you were looking for information about compiler flags in the documentation for the envvars; which perhaps wasn't the best systematic approach to research your problem? But hopefully you now have the information you need? Or at least better idea of how to find the answers you seek? >The team want one true way of building a go pkg. This is very true. However as long as your code follows the same standards it doesn't really matter how you chose to organise your source files as it should still compile on other people's systems using `go build` in the idiomatic way. And for what it's worth, a lot of people don't follow the directory hierarchy in the strictest way and/or use `go build/install`; choosing instead to use their preferred vendoring system. So I doubt many people would have a problem if you wanted to do your own thing just so long as the code is still compatible with Go's standard build tools should you release your projects to the world.