golang v1.12.7 安装
下载安装包
国外的
国内的
安装
mac os
- 直接点击
go1.12.7.darwin-amd64.pkg
,进入图形界面安装。 在
~/.zshrc
中,添加环境变量(如果是别的sh,请在别的sh中配置)#GOROOT export GOROOT=/usr/local/go/ #GOPATH go项目路径 export GOPATH=$HOME/workspace/project #GOPATH bin export PATH=$PATH:$GOPATH/bin #GOPATH root bin export PATH=$PATH:$GOROOT/bin
source ~/.zshrc
验证
# go version go version go1.12.7 darwin/amd64 # go env GOARCH="amd64" GOBIN="" GOCACHE="/Users/manshu/Library/Caches/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/manshu/workspace/project" GOPROXY="https://goproxy.io" GORACE="" GOROOT="/usr/local/go" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64" GCCGO="gccgo" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/wp/w879p9h15x983cgrs5cz25rc0000gn/T/go-build153405912=/tmp/go-build -gno-record-gcc-switches -fno-common"
linux
- 解压
tar xzvf go1.12.7.linux-amd64.tar.gz -C /usr/lib/
在
~/.bashrc
中,添加环境变量(如果是别的sh,请在别的sh中配置#GOROOT export GOROOT=/usr/lib/go #GOPATH go项目路径 export GOPATH=/root/gocode #GOPATH bin export PATH=$PATH:$GOPATH/bin #GOPATH root bin export PATH=$PATH:$GOROOT/bin
source ~/.bashrc
验证
[root@compute84 bin]# go version go version go1.12.7 linux/amd64 [root@compute84 bin]# [root@compute84 bin]# go env GOARCH="amd64" GOBIN="" GOCACHE="/root/.cache/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="/root/gocode" GOPROXY="https://goproxy.io" GORACE="" GOROOT="/usr/lib/go" GOTMPDIR="" GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64" GCCGO="gccgo" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build670179021=/tmp/go-build -gno-record-gcc-switches"
相关推荐
GoatSucker 2020-11-23
CoderToy 2020-11-16
蛰脚踝的天蝎 2020-11-10
ZGCdemo 2020-11-09
86193952 2020-10-27
Lzs 2020-10-23
hjr 2020-10-21
HELLOBOY 2020-10-21
qidiantianxia 2020-10-21
cmsmdn 2020-10-21
myspace 2020-10-21
笑面依旧 2020-10-21
专注前端开发 2020-10-21
技术之博大精深 2020-10-16
zhushenghan 2020-11-09
风雨断肠人 2020-10-13
xuguiyi00 2020-11-04
sichenglain 2020-10-27