golang
作者:互联网
wget https://dl.google.com/go/go1.11.5.linux-amd64.tar.gz
export GOROOT=/usr/local/go // go安装包的解压路径
export PATH=$PATH:$GOROOT/bin //配置go的bin目录.
export GOPATH=/root/go-demon //go的项目目录, 可以自行配置路径 GOPATH和GOROOT不能一样,
export PATH=$PATH:$GOPATH/bin
source /etc/profile
go version # 验证
package main import "fmt" func main() { fmt.Println("Hello, World!") }
go run hello.go
标签:bin,GOPATH,GOROOT,golang,export,go,PATH 来源: https://www.cnblogs.com/hanxing/p/15976898.html