使用 go1.21 开发,之前电脑有 1.19 版本
1.21 版本安装到了/Users/zhuxiaoyu/Desktop/go121 目录中
/etc/profile
# System-wide .profile for sh(1)
if [ -x /usr/libexec/path_helper ]; then
eval `/usr/libexec/path_helper -s`
fi
if [ "${BASH-no}" != "no" ]; then
[ -r /etc/bashrc ] && . /etc/bashrc
fi
export GOROOT=/Users/zhuxiaoyu/Desktop/go121
export GOPATH=/Users/zhuxiaoyu/Desktop/gopath
~/.bash_profile
export GOROOT=/Users/zhuxiaoyu/Desktop/go121
export GOPATH=/Users/zhuxiaoyu/Desktop/gopath
export GOBIN=$GOPATH/bin
export PROTOBUF_HOME=/usr/local/protobuf
export GO111MODULE=auto
PATH=$PATH:$GOBIN:$PROTOBUF_HOME/bin
~/.zshrc
export GOPATH=/Users/zhuxiaoyu/Desktop/gopath
export GOROOT=/Users/zhuxiaoyu/Desktop/go121
export GOBIN=$GOPATH/bin
export PROTOBUF_HOME=/usr/local/protobuf
export GO111MODULE=on
export GETHBIN=/Users/zhuxiaoyu/Desktop/geth/build/bin
go env
GO111MODULE='auto'
GOARCH='amd64'
GOBIN='/Users/zhuxiaoyu/Desktop/gopath/bin'
GOCACHE='/Users/zhuxiaoyu/Library/Caches/go-build'
GOENV='/Users/zhuxiaoyu/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/zhuxiaoyu/Desktop/gopath/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/zhuxiaoyu/Desktop/gopath'
GOPRIVATE=''
GOPROXY='https://goproxy.cn,direct'
GOROOT='/Users/zhuxiaoyu/Desktop/go121'
GOSUMDB=''
GOTMPDIR=''
GOTOOLCHAIN=''
GOTOOLDIR='/Users/zhuxiaoyu/Desktop/go121/pkg/tool/darwin_amd64'
GOVCS=''
GOVERSION='go1.21.0'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD=''
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/ys/nth2j_v53q55rqfkhvdfnj_80000gn/T/go-build2234700829=/tmp/go-build -gno-record-gcc-switches -fno-common
vscode 的配置
"go.alternateTools": {
"go.goroot":"/Users/zhuxiaoyu/Desktop/go121",
"go.gopath":"/Users/zhuxiaoyu/Desktop/gopath"
}
vscode 报错提示
go: cannot find GOROOT directory: /Users/zhuxiaoyu/Desktop/gopath/go1.19.9
都快疯了,到底这个 vscode 读的哪里的环境变量
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.