Skip to content
This repository was archived by the owner on Jul 15, 2023. It is now read-only.

Permission error when renaming symbol #3058

Closed
dylankb opened this issue Feb 19, 2020 · 5 comments
Closed

Permission error when renaming symbol #3058

dylankb opened this issue Feb 19, 2020 · 5 comments
Labels

Comments

@dylankb
Copy link

dylankb commented Feb 19, 2020

Please direct general questions to:

Please review the Wiki before filing an issue.
Helpful pages include:

Please answer these questions before submitting your issue. Thanks!

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

  • Run go version to get version of Go
    • go version go1.13.5 darwin/amd64
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders
    • 1.42.1
      c47d83b293181d9be64f27ff093689e8e7aed054
      x64
  • Check your installed extensions to get the version of the VS Code Go extension
  • Run go env GOOS GOARCH to get the operating system and processor arhcitecture details
    • darwin amd64

Share the Go related settings you have added/edited

Run Preferences: Open Settings (JSON) command to open your settings.json file.
Share all the settings with the go. or ["go"] prefixes.

Describe the bug

A clear and concise description of what the bug.

When I use the VS Code Rename Symbol functionality a failure message consistently pops up with "Rename failed to compute edits". In the Output tab I see an error string where a permission denied error occurrs with a number of files in $GOPATH/pkg/mod/. I could try changing file permissions with chmod but this seems like it shouldn't be happening in the first place. Here's the error string with some redactions below:

Rename failed: $MY_PATH/go/pkg/mod/google.golang.org/[email protected]/googleapis/rpc/status/status.pb.go:10:8: could not import github.com/golang/protobuf/proto (go/build: importGo github.com/golang/protobuf/proto: exit status 1 error writing go.mod: open $MY_PATH/go/pkg/mod/google.golang.org/[email protected]/go.mod298498081.tmp: permission denied  ) $MY_PATH/go/pkg/mod/google.golang.org/[email protected]/googleapis/rpc/status/status.pb.go:11:6: could not import github.com/golang/protobuf/ptypes/any (go/build: importGo github.com/golang/protobuf/ptypes/any: exit status 1 error writing go.mod: open $MY_PATH/go/pkg/mod/google.golang.org/[email protected]/go.mod298498081.tmp: permission denied  ) $MY_PATH/go/pkg/mod/github.com/golang/[email protected]/ptypes/any.go:42:2: could not import github.com/golang/protobuf/proto (go/build: importGo github.com/golang/protobuf/proto: exit status 1 error writing go.mod: open $MY_PATH/go/pkg/mod/github.com/golang/[email protected]/go.mod298498081.tmp: permission denied  ) $MY_PATH/go/pkg/mod/github.com/golang/[email protected]/ptypes/any.go:43:2: could not import github.com/golang/protobuf/ptypes/any (go/build: importGo github.com/golang/protobuf/ptypes/any: exit status 1 error writing go.mod: open $MY_PATH/go/pkg/mod/github.com/golang/[email protected]/go.mod298498081.tmp: permission denied  ) $MY_PATH/go/pkg/mod/github.com/golang/[email protected]/ptypes/duration.go:42:8: could not import github.com/golang/protobuf/ptypes/duration (go/build: importGo github.com/golang/protobuf/ptypes/duration: exit status 1 error writing go.mod: open $MY_PATH/go/pkg/mod/github.com/golang/[email protected]/go.mod298498081.tmp: permission denied  ) $MY_PATH/go/pkg/mod/github.com/golang/[email protected]/ptypes/timestamp.go:41:7: could not import github.com/golang/protobuf/ptypes/timestamp (go/build: importGo github.com/golang/protobuf/ptypes/timestamp: exit status 1 error writing go.mod: open $MY_PATH/go/pkg/mod/github.com/golang/[email protected]/go.mod298498081.tmp: permission denied  ) $MY_PATH/go/pkg/mod/github.com/golang/[email protected]/ptypes/duration/duration.pb.go:8:8: could not import github.com/golang/protobuf/proto (go/build: importGo github.com/golang/protobuf/proto: exit status 1 error writing go.mod: open $MY_PATH/go/pkg/mod/github.com/golang/[email protected]/go.mod298498081.tmp: permission denied  ) $MY_PATH/go/pkg/mod/github.com/golang/[email protected]/ptypes/timestamp/timestamp.pb.go:8:8: could not import github.com/golang/protobuf/proto (go/build: importGo github.com/golang/protobuf/proto: exit status 1 error writing go.mod: open $MY_PATH/go/pkg/mod/github.com/golang/[email protected]/go.mod298498081.tmp: permission denied  ) $MY_PATH/go/pkg/mod/golang.org/x/[email protected]/trace/histogram.go:17:2: could not import golang.org/x/net/internal/timeseries (go/build: importGo golang.org/x/net/internal/timeseries: exit status 1 error writing go.mod: open $MY_PATH/go/pkg/mod/golang.org/x/[email protected]/go.mod298498081.tmp: permission denied  ) $MY_PATH/go/pkg/mod/golang.org/x/[email protected]/http2/frame.go:17:2: could not import golang.org/x/net/http/httpguts (go/build: importGo golang.org/x/net/http/httpguts: exit status 1 error writing go.mod: open $MY_PATH/go/pkg/mod/golang.org/x/[email protected]/go.mod298498081.tmp: permission denied  ) $MY_PATH/go/pkg/mod/golang.org/x/[email protected]/http2/frame.go:18:2: could not import golang.org/x/net/http2/hpack (go/build: importGo golang.org/x/net/http2/hpack: exit status 1 error writing go.mod: open $MY_PATH/go/pkg/mod/golang.org/x/[email protected]/go.mod298498081.tmp: permission denied  ) $MY_PATH/go/pkg/mod/golang.org/x/[email protected]/http2/transport.go:35:2: could not import golang.org/x/net/idna (go/build: importGo golang.org/x/net/idna: exit status 1 error writing go.mod: open $MY_PATH/go/pkg/mod/golang.org/x/[email protected]/go.mod298498081.tmp: permission denied  ) gorename: couldn't load packages due to errors: github.com/golang/protobuf/ptypes/duration, github.com/golang/protobuf/ptypes, google.golang.org/genproto/googleapis/rpc/status and 3 more
@dylankb dylankb changed the title Permission error when renaming symbol - Go Permission error when renaming symbol Feb 19, 2020
@stamblerre
Copy link
Contributor

Are you using the language server? Renaming without the language server is not supported for projects using modules. You can enable the language server by setting "go.useLanguageServer": true. More details are available here.

@dylankb
Copy link
Author

dylankb commented Feb 20, 2020 via email

@hyangah
Copy link
Contributor

hyangah commented Feb 20, 2020

golang/go#34222

I am guessing gorename is somewhat broken even in (implicit) GOPATH mode since go 1.13. Go1.13 started to enable the module-aware mode when GO111MODULE=auto (https://golang.org/doc/go1.13#modules) and it affects the loading of the packages under GOPATH that have go.mod. Can you try with explicitly setting GO111MODULE=off?

@hyangah
Copy link
Contributor

hyangah commented Feb 20, 2020

And gopls should work in GOPATH mode too. So, try the gopls language server when you feel ready.

@dylankb
Copy link
Author

dylankb commented Feb 20, 2020

Unlike others, setting GO111MODULE=off did not fix the issue. However, switching to the gopls did fix the issue even with GO111MODULE=auto. For some reason I assumed gopls was only for projects using modules. Thanks!

@dylankb dylankb closed this as completed Feb 20, 2020
@vscodebot vscodebot bot locked and limited conversation to collaborators Apr 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants