Install Go
Environment
- Debian 9.5 x64
- GVM2 v0.10.6
- Go 1.9.7
Excerpt https://github.com/markeissler/gvm2
Log 2018 / 11
1. Pre
root@athos:~# apt-get update && apt-get -y upgrade && apt-get -y dist-upgrade
apt-get -y --no-install-recommends install \
curl git make binutils bison gcc build-essential
root@athos:~# apt-get -y --no-install-recommends install \
> curl git make binutils bison gcc build-essential
2. Install GVM2
curl -sSL \
https://raw.githubusercontent.com/markeissler/gvm2/master/binscripts/gvm-installer | \
bash
root@athos:~# curl -sSL \
> https://raw.githubusercontent.com/markeissler/gvm2/master/binscripts/gvm-installer | \
> bash
Cloning from https://github.com/markeissler/gvm2.git to /root/.gvm
No existing Go versions detected.
Installed GVM2 v0.10.6
Please restart your terminal session or to get started right away run
prompt> source /root/.gvm/scripts/gvm
Support for auto selection of Go version and GVM2 pkgset (via .go-version
and .go-pkgset files) requires that GVM2 is loaded after RVM (if installed).
For bash, you may need to manually update your .profile or .bash_profile
files; for zsh, you may need to manually update your .zlogin file.
Additional dependencies may need to be installed before GVM2 can operate
correctly.
See the README.md file for more information.
root@athos:~# source /root/.gvm/scripts/gvm
root@athos:~# gvm version
GVM2 v0.10.6 installed at /root/.gvm
3. Install Go
Pre-requisite Go 1.4.3 is no longer needed.
root@athos:~# gvm listall | tail -10
go1.9.3
go1.9.4
go1.9.5
go1.9.6
go1.9.7
go1.9beta1
go1.9beta2
go1.9rc1
go1.9rc2
root@athos:~# gvm install go1.9.7 -B
Installing go1.9.7 from binary source
Package set (pkgset) created successfully
root@athos:~# gvm list
gvm gos (installed)
=> go1.9.7
root@athos:~# gvm use go1.9.7
Now using version go1.9.7
root@athos:~# go version
go version go1.9.7 linux/amd64
4. Hello, World!
cat <<EOF > example.go
package main
import "fmt"
func main() {
fmt.Printf("Hello World!\n")
}
EOF
root@athos:~# cat <<EOF > example.go
> package main
>
> import "fmt"
>
> func main() {
> fmt.Printf("Hello, World!\n")
> }
> EOF
root@athos:~# go build example.go
root@athos:~# chmod a+x example ; ./example
Hello, World