Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
doc: $GOPATH is opaque even if you find the doc #9228
Rick and Austin both ran into problems with trying to set up $GOPATH. They both found https://golang.org/doc/code.html but it didn't help either of them. Perhaps the doc should start out more prescriptive and only then move into the description of what a workspace is.
Also, the recipe given uses $HOME/go as $GOPATH, which is just about the worst possible suggestion, because it's where we tell people to check out Go trees in http://golang.org/doc/install/source. This doc should probably use $HOME/work. People will be able to figure out how to generalize to other values of 'work'.
It looks like all the necessary information is in the doc, it's just too hard to find if you're skimming trying to solve a problem. Maybe there should be a short intro that hits the highlights:
(1) mkdir $HOME/work; export GOPATH=$HOME/work; export PATH=$GOPATH/bin:$PATH
and then the rest of the doc can elaborate.
Expanding on (2), it would be helpful to directly dispel reader's preconceptions. I got tripped up by where to put different Go projects because I was thinking in a traditional model where each project has a separate and unrelated top-level workspace directory and that's what you put under version control. It would have helped me if the document explicitly said something like "Typically, there is just one Go workspace shared by all Go projects (everything that you 'go get' and everything you start yourself)."
added a commit
Dec 16, 2014
On Mon, Dec 15, 2014 at 8:15 PM, Andrew Gerrand email@example.com
Looking back at the document now I see one ".git" nested in the workspace
In fact, I actually have notes from when I read this document that capture
Of course, now I understand that the single workspace layout doesn't