Cx330

Golang 技巧汇总

Golang 技巧汇总
2019-09-18 · 1 min read
develop Go server

交叉编译

CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go install version_pro.go

CentOS下载解压Golang

wget https://storage.googleapis.com/golang/go1.10.linux-amd64.tar.gz
tar -zxvf go1.8.linux-amd64.tar.gz -C /usr/local

配置环境

sudo vim /etc/profile

export GOROOT=/usr/local/go 
export GOPATH=/home/ubuntu/webgo
export PATH=$GOROOT/bin:$PATH
export GOBIN=/home/ubuntu/webgo/bin

source /etc/profile