Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gorename: package xxx is not in GOROOT #92

Closed
taobaohi opened this issue May 25, 2020 · 3 comments
Closed

gorename: package xxx is not in GOROOT #92

taobaohi opened this issue May 25, 2020 · 3 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@taobaohi
Copy link

taobaohi commented May 25, 2020

Please direct general questions to:

Please review the documentation 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
    • 1.14
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders
    • 1.45.1
  • Check your installed extensions to get the version of the VS Code Go extension
    • 0.14.3
  • Run go env to get the go development environment details
$ go env
set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\admin\AppData\Local\go-build
set GOENV=C:\Users\admin\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GONOPROXY=gitlab.c21sis.com
set GONOSUMDB=gitlab.c21sis.com
set GOOS=windows
set GOPATH=d:\go_workspace
set GOPRIVATE=gitlab.c21sis.com
set GOPROXY=https://goproxy.io/
set GOROOT=c:\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=D:\go_workspace\src\pink-api\go.mod
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\admin\AppData\Local\Temp\go-build671071106=/tmp/go-build -gno-record-gcc-switches

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"] or gopls prefixes.

{
    "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
    "terminal.external.windowsExec": "C:\\Program Files\\Git\\bin\\bash.exe",
    "window.zoomLevel": 0,
    "go.formatTool": "goimports",
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "files.exclude": {
        "**/.classpath": true,
        "**/.project": true,
        "**/.settings": true,
        "**/.factorypath": true
    },
    "editor.fontSize": 16,
    "files.autoSave": "afterDelay",
    "java.home": "C:\\Program Files\\RedHat\\java-11-openjdk-11.0.6-2\\",
    "java.help.firstView": "gettingStarted",
    "java.requirements.JDK11Warning": true,
    "maven.terminal.useJavaHome": true,
    "java.semanticHighlighting.enabled": true,
    "terminal.integrated.shell.linux": "",
    "terminal.integrated.automationShell.linux": "",
    "terminal.integrated.automationShell.osx": "",
    "terminal.integrated.automationShell.windows": "",
    "java.configuration.runtimes": [
        {
            "name": "JavaSE-11",
            "path": "C:\\Program Files\\RedHat\\java-11-openjdk-11.0.6-2\\",
        }
    ],
    "java.maven.updateSnapshots": true,
    "maven.executable.path": "C:\\java\\apache-maven-3.6.3\\bin\\mvn",
    "java.configuration.maven.userSettings": "C:\\java\\apache-maven-3.6.3\\conf\\settings.xml",
    "java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -javaagent:\"c:\\Users\\admin\\.vscode\\extensions\\gabrielbb.vscode-lombok-1.0.1\\server\\lombok.jar\"",
    "remote.SSH.remotePlatform": {
        "105": "linux"
    },
    "git.ignoreLegacyWarning": true,
    "go.autocompleteUnimportedPackages": true,
    "go.addTags": {
    
    }
}

Describe the bug

A clear and concise description of what the bug.
A clear and concise description of what you expected to happen.

Steps to reproduce the behavior:

  1. seelct type name
  2. press F2 rename
  3. See error :Rename failed: gorename: package pink-api/service/sissvc is not in GOROOT (c:\go\src\pink-api\service\sissvc)

Screenshots or recordings

If applicable, add screenshots or recordings to help explain your problem.

@taobaohi taobaohi changed the title Rename failed: gorename: package pink-api/service/sissvc is not in GOROOT Rename failed: gorename: package xxx is not in GOROOT May 25, 2020
@hyangah
Copy link
Contributor

hyangah commented May 26, 2020

You are using Go in modules mode (based on set GOMOD=D:\go_workspace\src\pink-api\go.mod). I don't think gorename, the underlying tool used in this case, supports module mode. golang/go#24661

For modules mode, we recommend gopls instead

"go.useLanguageServer": true

@hyangah hyangah added the upstream-tools Issues that are caused by problems in the tools that the extension depends on. label May 26, 2020
@hyangah hyangah changed the title Rename failed: gorename: package xxx is not in GOROOT gorename: package xxx is not in GOROOT May 26, 2020
@stamblerre stamblerre added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed upstream-tools Issues that are caused by problems in the tools that the extension depends on. labels May 26, 2020
@stamblerre
Copy link
Contributor

As @hyangah says, this is working as intended for modules. We will only be supporting rename through gopls - please open a new issue if you have difficulties setting up gopls.

@taobaohi
Copy link
Author

@hyangah thanks!
setting-->search ''go.useLanguageServer"--->enable checkbox--->auto download gopls.
go rename bug fix!

@golang golang locked and limited conversation to collaborators May 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants