Currently, there are trends on software development that tend to release their SDK on regular basis. Rust for example, also Go with 6 month release cycle. This predictable release is good and I personally like it since I can predict on features availability and use them for my software development project. The downside of this approach is there are many versions availablle that install them using OS package manager is proved to be pain in the ass.
Some of developers then create tools to manage multiple versions of the SDK, see
GVM (Go Version Manager) and
multirust (for Rust) for example. They are good of course but I probably choose not to use them since probably someday they won't be developed (see the latest commit if you want). My approach is simpler but only for Linux with Bash. If you use Windows, you may adopt my approach using SET to setup env variables and put them in batch file (.BAT). Explanation follows.
Directory Setup
I put all of my Go related software inside
/opt/software/go-dev-tools. Here's the structure:
Directory Contents
I put Go SDK inside
go, all Go related tools inside
go-tools,
liteide for LiteIDE, and
tmp for temporary pkg dir whenever I want to compile and put
Go tools inside
go-tools.
Inside go-version (go1.2.2, go1.3.3, etc), I extract all of downloaded SDK from
Go download page.
Environment Variables
In my $HOME/env dir, I created
go directory to manage environment variables for my Go version. They usually have the same env variables, except for version pre 1.5, 1.5 (for vendor experimentation) and 1.6.
Pre 1.5 and > 1.6
$ cat ~/env/go/go1.2.2
GODEVTOOLS_HOME=/opt/software/go-dev-tools
GO_HOME=$GODEVTOOLS_HOME/go/go1.2.2
LITEIDE_HOME=$GODEVTOOLS_HOME/liteide
GOTOOLS=$GODEVTOOLS_HOME/go-tools
export GOROOT=$GO_HOME
export GOOS=linux
export GOARCH=amd64
export GOHOSTOS=linux
export GOHOSTARCH=amd64
export GOBIN=$GOROOT/bin
export PATH=$PATH:$GO_HOME/bin:$LITEIDE_HOME/bin:$GOTOOLS
alias go=colorgo$
1.5
$ cat ~/env/go/go1.5.3
GODEVTOOLS_HOME=/opt/software/go-dev-tools
GO_HOME=$GODEVTOOLS_HOME/go/go1.5.3
LITEIDE_HOME=$GODEVTOOLS_HOME/liteide
GOTOOLS=$GODEVTOOLS_HOME/go-tools
export GOROOT=$GO_HOME
export GOOS=linux
export GOARCH=amd64
export GOHOSTOS=linux
export GOHOSTARCH=amd64
export GOBIN=$GOROOT/bin
export PATH=$PATH:$GO_HOME/bin:$LITEIDE_HOME/bin:$GOTOOLS
alias go=colorgo
export GO15VENDOREXPERIMENT=1
$
Usage
Open new shell - terminal, and source environment variables:
$ source env/go/go1.2.2
11:25:22-bpdp@archer:~$ go version
go version go1.2.2 linux/amd64
11:25:25-bpdp@archer:~$
Open another new shell - terminal, and source env vars:
$ source env/go/go1.6.0
11:25:59-bpdp@archer:~$ go version
go version go1.6 linux/amd64
11:26:01-bpdp@archer:~$
and so on.
Go Tools
When you see something interesting for your Go project, just go to
/opt/software/go-dev-tools/tmp and the Go get them and copy the files inside
/opt/software/go-dev-tools/go-tools:
$ cd /opt/software/go-dev-tools/tmp/
$ export GOPATH=`pwd`
$ go get github.com/smartystreets/goconvey
$ mv ../go/go1.6/bin/goconvey ../go-tools/
$ which goconvey
/opt/software/go-dev-tools/go-tools/goconvey
$
I don't know whether my approach is the best, but it proves to be comfortable for me. As always, YMMV. Happy hacking!
Arch Linux, Mplayer, and Chromium Sound Problem