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

gorename: can't find package containing... when using modules #2074

Closed
bitfield opened this issue Nov 2, 2018 · 9 comments
Closed

gorename: can't find package containing... when using modules #2074

bitfield opened this issue Nov 2, 2018 · 9 comments
Labels
go-modules Related to Go modules

Comments

@bitfield
Copy link

bitfield commented Nov 2, 2018

Steps to Reproduce:

  1. In this repo: https://github.com/bitfield/uptimerobot
  2. Open main.go, select the main identifier, and 'Rename symbol' to anything.
  3. Error message in output:
Rename failed: gorename: can't find package containing /Users/john/git/bitfield/uptimerobot/main.go 

GOPATH is not set and there is a valid go.mod file in the module root.

go version go1.11.1 darwin/amd64
vscode-go 0.6.94-beta4
Code 1.28.2
@lanrat
Copy link

lanrat commented Nov 3, 2018

I'm having the same issue, unfortunately it appears that the gorename tool does not yet support go modules.

More info: #1954 (comment)

@bitfield
Copy link
Author

bitfield commented Nov 4, 2018

I thought @ramya-rao-a had already forked gorename to add module support... or was that wishful thinking on my part?

@ramya-rao-a
Copy link
Contributor

gorename doesn't yet support modules.

See Go modules support in Visual Studio Code

@ramya-rao-a ramya-rao-a changed the title gorename: can't find package containing... gorename: can't find package containing... when using modules Nov 4, 2018
@ramya-rao-a ramya-rao-a added the go-modules Related to Go modules label Nov 4, 2018
@rohmanhm
Copy link

rohmanhm commented Nov 14, 2018

image

Using with Find All References it works fine. I thought it was a bug. But after browsing gorename it turns out that it doesn't support go modules yet.

If you still curious, You can track current status about gorename, here's the links:

@lanrat
Copy link

lanrat commented Dec 19, 2018

Slight update in the Go Modules in 2019 blog post today. It looks like the new golang.org/x/tools/go/packages package will be the place where this, and other IDE integrations will implemented with support for modules.

@shaodahong
Copy link

@ramya-rao-a go module in vscode now supported, please review this issue

@douglarek
Copy link

douglarek commented Jul 1, 2019

gopls has supported go rename(golang/go#27571 (comment)), and vscode-go has supported it too.

Please update your gopls codes and only use this settings:

 "go.useLanguageServer": true,

@ramya-rao-a
Copy link
Contributor

Thanks for the update @douglarek and @shaodahong

@douglarek The value for the setting go.languageServerExperimentalFeatures that you have shared is the default value, so one doesn't need to specify the same in settings again. Would you mind updating your instructions?

The only 2 things to ensure are

  • Have the setting "go.useLanguageServer": true
  • Get the latest version gopls

@shaodahong
Copy link

ok, found need update gopls version

@vscodebot vscodebot bot locked and limited conversation to collaborators Aug 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
go-modules Related to Go modules
Projects
None yet
Development

No branches or pull requests

6 participants