3 ms·
What is elegant about the use of an environment variable? From what I can see on the net, the requirement for all GO projects to exist within $GOPATH mainly see
by WorldWideWayne 13y ago
What is elegant about the use of an environment variable? From what I can see on the net, the requirement for all GO projects to exist within $GOPATH mainly seems to confuse and annoy people.
A couple of examples:
- https://groups.google.com/forum/#!topic/golang-nuts/9WCKPKTOVbE https://groups.google.com/forum/#!topic/golang-nuts/9WCKPKTO...
- http://stackoverflow.com/q/17780754 http://stackoverflow.com/q/17780754
UPDATE: Please tell me what I said wrong here so that I can avoid being downvoted in the future. I was not trying to be offensive. Sorry.
- nanofortnight 13y ago”Elegant” wouldn't be a world I would use. ”Standardisation” would be more like it. Though you could have separate $GOPATH for each project. Note that $GOPATH can be colon delimited (though `go get` will download packages to the first directory in the list). You could use something like http://swapoff.org/ondir.html http://swapoff.org/ondir.html to switch out $GOPATH depending on which directory you are in in your shell.
- NateDad 13y agoIt's elegant, because all code generally lives in a repo online somewhere, and by having a canonical place for that code to live on your local disk, it's trivial to have code that references other code that lives online somewhere else, and you can get all of it with a single command. If I go get your package, and your package uses someone else's package, I get their code too. It's quite elegant. And all it needs is one little environment variable that says "store my go code here".