raspberryPiにgvmでGoをインストールする方法
gvmとはgo version managerで、文字通りgo のvesionマネジメントシステム
GitHub - moovweb/gvm: Go Version Manager
rvmに影響を受けているらしく、似たようなコマンドで使用することが出来る
install library
$ sudo apt-get install curl git mercurial make binutils bison gcc build-essential
install gvm
### install $ bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer) Cloning from https://github.com/moovweb/gvm.git to /home/pi/.gvm No existing Go versions detected Installed GVM v1.0.22 Please restart your terminal session or to get started right away run `source /home/pi/.gvm/scripts/gvm` $ source /home/pi/.gvm/scripts/gvm ### confirm $ gvm help Usage: gvm [command] Description: GVM is the Go Version Manager Commands: version - print the gvm version number get - gets the latest code (for debugging) use - select a go version to use (--default to set permanently) diff - view changes to Go root help - display this usage text implode - completely remove gvm install - install go versions uninstall - uninstall go versions cross - install go cross compilers linkthis - link this directory into GOPATH list - list installed go versions listall - list available versions alias - manage go version aliases pkgset - manage go packages sets pkgenv - edit the environment for a package set $ gvm version Go Version Manager v1.0.22 installed at /home/pi/.gvm
install Go
gvmは全ての基点に1.4を利用しているようで、他のversionを利用するつもりでもまずは1.4をinstallしなければならない
install go1.4
$ gvm install go1.4 Installing go1.4... * Compiling... go1.4 successfully installed! $ gvm list gvm gos (installed) go1.4 $ gvm use go1.4 Now using version go1.4 $ gvm list gvm gos (installed) => go1.4
install go1.5
他のversionのinstallの確認として、stableの最新版である1.7.5をinstallしてみる
### install $ echo $GOROOT /home/pi/.gvm/gos/go1.4 $ export GOROOT_BOOTSTRAP=$GOROOT $ gvm install go1.7.5 Installing go1.7.5... * Compiling... go1.7.5 successfully installed! $ gvm use go1.7.5 --default Now using version go1.7.5 $ gvm list gvm gos (installed) go1.4 => go1.7.5 ### confirm $ go version go version go1.7.5 linux/arm