Skip to content

Saving (with automatic build) a new .go file results in "/usr/local/go/pkg/darwin_amd64/runtime/cgo.a: permission denied" #568

@andreagrandi

Description

@andreagrandi

What version of Go, VS Code & VS Code Go extension are you using?

  • Run go version to get version of Go
    • go version go1.15 darwin/amd64
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders
    • 1.48.1 3dd905126b34dcd4de81fa624eb3a8cbe7485f13 x64
  • Check your installed extensions to get the version of the VS Code Go extension
    • v0.16.1
  • Run go env to get the go development environment details
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/andrea/Library/Caches/go-build"
GOENV="/Users/andrea/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/andrea/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/andrea/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/v7/p2rlmknn79g8l2772yyqnp6w0000gn/T/go-build964988215=/tmp/go-build -gno-record-gcc-switches -fno-common"

Share the Go related settings you have added/edited

"go.autocompleteUnimportedPackages": true,
"go.formatTool": "goimports"

Describe the bug

On MacOS, after having installed Go 1.15 from the official package and having configured PATH etc... if you try to create a new Go app with VSCode and auto build kick in (as it should), you get an error mentioning "/usr/local/go/pkg/darwin_amd64/runtime/cgo.a: permission denied"

I originally commented this bug golang/go#37962 but they mentioned this happens because VSCode Go extension still uses the -i option.

I was able to workaround the problem by running this sudo chown -R andrea /usr/local/go/pkg/darwin_amd64/ but I think it would be nice if this issue didn't happen at all.

Steps to reproduce the behavior:

  1. install Go 1.15 on MacOS using the official installer
  2. create a new project on VSCode with Go extension
  3. write any meaningful code that can compile
  4. you will see a red underlining below package main (note: if you go build . the code compiles just fine).

Screenshots or recordings

Screenshot 2020-08-22 at 15 46 26

Related issues

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions