gpt4 book ai didi

go build -i 导致打开/usr/local/go/pkg/darwin_amd64/runtime/cgo.a : permission denied

转载 作者:行者123 更新时间:2023-12-03 13:18:56 28 4
gpt4 key购买 nike

我建立我的项目使用

go build -i -v -o ./bin/demo-api .

得到结果
go build runtime/cgo: copying /Users/hrbc/Library/Caches/go-build/63/63a132c80210b5c7b4f4ed9a902aaec712c42b15e23aa2c1b1778e2f85165d04-d: open /usr/local/go/pkg/darwin_amd64/runtime/cgo.a: permission denied

没有 -i 选项它工作得很好。我可以做些什么来解决这个问题?

go 版本 go1.14 darwin/amd64
去环境
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/hrbc/Library/Caches/go-build"
GOENV="/Users/hrbc/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/hrbc/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
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/7n/bh7jk7s95_3gljs6gf3405k00000gn/T/go-build782113827=/tmp/go-build -gno-record-gcc-switches -fno-common"

最佳答案

你可以试试:

sudo chmod -R 777 /usr/local/go

似乎 go 没有足够的权限来执行某些操作。我有同样的问题,并且为我解决了

关于go build -i 导致打开/usr/local/go/pkg/darwin_amd64/runtime/cgo.a : permission denied,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60771344/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com