1.搭建golang運行環(huán)境:
下載:https://www.golangtc.com/download
解壓:
tar zxvf go1.6.3.linux-amd64.tar.gz -C /mnt/soft/
添加環(huán)境變量:
vim /etc/profile
//profile內(nèi)添加
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")
}