Vscode go build problem

vs

file: ‘file:///Users/bzy/work/go_project/usersvc/main.go’
severity: ‘错误’
message: 'go build golang_org/x/crypto/cryptobyte/asn1: open /usr/local/go/pkg/darwin_amd64/vendor/golang_org/x/crypto/cryptobyte/asn1.a: permission denied
go build golang_org/x/net/dns/dnsmessage: open /usr/local/go/pkg/darwin_amd64/vendor/golang_org/x/net/dns/dnsmessage.a: permission denied
go build golang_org/x/crypto/curve25519: open /usr/local/go/pkg/darwin_amd64/vendor/golang_org/x/crypto/curve25519.a: permission denied
go build golang_org/x/text/transform: open /usr/local/go/pkg/darwin_amd64/vendor/golang_org/x/text/transform.a: permission denied
go build golang_org/x/crypto/poly1305: open /usr/local/go/pkg/darwin_amd64/vendor/golang_org/x/crypto/poly1305.a: permission denied
go build golang_org/x/crypto/internal/chacha20: open /usr/local/go/pkg/darwin_amd64/vendor/golang_org/x/crypto/internal/chacha20.a: permission denied
go build golang_org/x/net/route: open /usr/local/go/pkg/darwin_amd64/vendor/golang_org/x/net/route.a: permission denied
go build golang_org/x/net/http2/hpack: open /usr/local/go/pkg/darwin_amd64/vendor/golang_org/x/net/http2/hpack.a: permission denied
go build golang_org/x/text/unicode/bidi: open /usr/local/go/pkg/darwin_amd64/vendor/golang_org/x/text/unicode/bidi.a: permission denied

at: ‘1,1’
source: ‘’
code: ‘undefined’

What happens when you run go build in your project directory from the command line?

i run go build it has no problem, but when i debug there are some problems like /usr/local/go/pkg/darwin_amd64/vendor/golang_org/x/crypto/cryptobyte/asn1.a: permission denied
go build golang_org/x/net/dns/dnsmessage: open

Try to chmod

That’s because the debug not able to recognize the origin chmod will change permissions likely

Id be very careful with chmoding around outside of $HOME

I’d start with uninstalling and then reinstalling go in this case, and double check to not miss any step in the installation instructions.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.