go升级到1.16

coding

golang 多个版本管理

  • 下载页面
  • 多个版本管理

1.下载go1.16

➜  bin pwd

/Users/xxxx/go-dev/bin

➜ bin go get golang.org/dl/go1.15.8

go: finding golang.org/dl latest

➜ bin ll

total 28816

-rwxr-xr-x 1 xxxxx staff 7.0M 2 20 18:33 go1.15.8

-rwxr-xr-x 1 xxxxx staff 7.0M 2 20 18:31 go1.16

确保可执行路径已经添加到PATH中.

# go

export GOPATH="${HOME}/go-dev"

# GOROOT是GO的安装路径

export GOROOT="$(brew --prefix golang)/libexec"

export PATH="$PATH:${GOPATH}/bin:${GOROOT}/bin"

新开终端/或者重新激活一下zshrc

2.下载go1.16 同时配置go1.16 env GOROOT

➜  ~ go1.16

go1.16: not downloaded. Run 'go1.16 download' to install to /Users/xxxxxx/sdk/go1.16

➜ ~ go1.16 download

➜ ~ go1.16 download

Downloaded 0.0% ( 31638 / 130169373 bytes) ...

Downloaded 100.0% (130169373 / 130169373 bytes)

Unpacking /Users/xxxxxx/sdk/go1.16/go1.16.darwin-amd64.tar.gz ...

Success. You may now run 'go1.16'

➜ ~ go1.16 version

go version go1.16 darwin/amd64

➜ ~

➜ ~ go1.16 env GOROOT

/Users/xxxxxx/sdk/go1.16

➜ ~ go1.16 env

GO111MODULE="on"

GOARCH="amd64"

GOBIN=""

GOCACHE="/Users/xxxxxx/Library/Caches/go-build"

GOENV="/Users/xxxxxx/Library/Application Support/go/env"

GOEXE=""

GOFLAGS=""

GOHOSTARCH="amd64"

GOHOSTOS="darwin"

GOINSECURE=""

GOMODCACHE="/Users/xxxxxx/go-dev/pkg/mod"

GONOPROXY=""

GONOSUMDB=""

GOOS="darwin"

GOPATH="/Users/xxxxxx/go-dev"

GOPRIVATE=""

GOPROXY="https://goproxy.cn/"

GOROOT="/Users/xxxxxx/sdk/go1.16"

GOSUMDB="sum.golang.org"

GOTMPDIR=""

GOTOOLDIR="/Users/xxxxxx/sdk/go1.16/pkg/tool/darwin_amd64"

GOVCS=""

GOVERSION="go1.16"

GCCGO="gccgo"

AR="ar"

CC="clang"

CXX="clang++"

CGO_ENABLED="1"

GOMOD="/dev/null"

CGO_CFLAGS="-g -O2"

CGO_CPPFLAGS=""

CGO_CXXFLAGS="-g -O2"

CGO_FFLAGS="-g -O2"

CGO_LDFLAGS="-g -O2"

PKG_CONFIG="pkg-config"

GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/w9/y8yp7pns0ms60s4742_9g65r0000gn/T/go-build764967041=/tmp/go-build -gno-record-gcc-switches -fno-common

以上是 go升级到1.16 的全部内容, 来源链接: utcz.com/z/510262.html

回到顶部