cannot install cross-compiled bi
2023-12-18 本文已影响0人
河码匠
解决方法1
修改 .zshrc
或 .bashrc
或 .bash_profile
中的 GOBIN
注释掉
重启终端,重新执行安装命令
解决方法2
临时清空 unset GOBIN
然后重新安装
解决办法3
go env
查看 GOBIN
是否是空
GOARCH
和 GOHOSTARCH
和 GOOS
是否和你当前系统一致
# go env
GO111MODULE='on'
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/Library/Caches/go-build'
GOENV='/Users/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/machao/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/homebrew/Cellar/go/1.21.5/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/homebrew/Cellar/go/1.21.5/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.21.5'
GCCGO='gccgo'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/dev/null'
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 arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/81/r5d92sr51yv2cn4h4b8fdd5c0000gn/T/go-build425150459=/tmp/go-build -gno-record-gcc-switches -fno-common'