Until now, I use different workspaces either when I want to use a different version of Go, or I want to separate my personal work from the code with which children and I are happy. Also, if I want to play with some kind of open source, but want an easy way to clean it up later.
Sort of
mk /tmp/tmpgo cd /tmp/tmpgo
The setenv file looks something like this.
export GOROOT=$HOME/go16 export GOPATH=$PWD export GOBIN=$GOPATH/bin export PATH=$GOROOT/bin:$GOPATH/bin:$PATH export PS1='\[\033[01;32m\]workspacenamehere\[\033[01;33m\] \W\[\033[00m\] '
This gives me a go workspace with its own subdirectories bin, src, pkg. I can get whatever I want. Later I can delete the entire temporary directory if I want. Getting things from repositories such as github.com tends to get a lot of packages from other members, but because they put them in a clean src subdirectory, it's easy to use find and see what has been taken down. And then even easier to remove everything from hd again.
source share