1.搭建golang运行环境:
下载:https://www.golangtc.com/download
解压:
tar zxvf go1.6.3.linux-amd64.tar.gz -C /mnt/soft/
添加环境变量:
vim /etc/profile
//profile内添加
export GOROOT=/mnt/soft/go
export GOPATH=/mnt/work/workspace/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
:wq!
//使profile立即生效
source /etc/profile
test:
package main
import "fmt"
func main {
fmt.Printf("hello,world!\n")
}
网友评论