$ wget http://www.golangtc.com/static/go/1.6.2/go1.6.2.linux-amd64.tar.gz
$ tar -zxf go1.6.2.linux-amd64.tar.gz -C /usr/local/
$ mkdir /Golang
在 /etc/profile 添加:
export GOROOT=/usr/local/go然后执行
export GOBIN=$GOROOT/bin
export GOPKG=$GOROOT/pkg/tool/linux_amd64
export GOARCH=amd64
export GOOS=linux
export GOPATH=/Golang
export PATH=$PATH:$GOBIN:$GOPKG:$GOPATH/bin
source/etc/profile
使之生效。
package mainimport"fmt"funcmain() { fmt.Printf("Let's go\n")}
$ go run demo.go
运行:
$ ./demo