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

Goto Definition Action for imports also Unexpectedly Opens Documentation in Browser #3041

Closed
niranjan94 opened this issue Nov 10, 2023 · 1 comment

Comments

@niranjan94
Copy link

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

Version Information
  • Run go version to get version of Go from the VS Code integrated terminal.
    • go version go1.21.3 linux/amd64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
    • v0.14.1
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
1.84.2
1a5daa3a0231a0fbba4f14db7ec463cf99d7768e
x64
  • Check your installed extensions to get the version of the VS Code Go extension
    • v0.39.1
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.
GOBIN: undefined
toolsGopath: 
gopath: /home/redacted/go
GOROOT: /home/linuxbrew/.linuxbrew/Cellar/go/1.21.3/libexec
PATH: /home/redacted/.vscode-server/bin/1a5daa3a0231a0fbba4f14db7ec463cf99d7768e/bin/remote-cli:/home/redacted/.bun/bin:/home/redacted/.local/share/pnpm:/run/user/1000/fnm_multishells/1165889_1699615402877/bin:/home/redacted/.local/share/fnm:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:/home/redacted/.pyenv/shims:/home/redacted/.pyenv/bin:/home/redacted/bin:/usr/local/bin:/home/redacted/.cargo/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/redacted/.antigen/bundles/robbyrussell/oh-my-zsh/lib:/home/redacted/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/git:/home/redacted/.antigen/bundles/zsh-users/zsh-syntax-highlighting:/home/redacted/.antigen/bundles/zsh-users/zsh-autosuggestions:/home/redacted/.antigen/bundles/zsh-users/zsh-completions

	go:	/home/linuxbrew/.linuxbrew/bin/go: go version go1.21.3 linux/amd64

	gotests:	/home/redacted/go/bin/gotests	(version: v1.6.0 built with go: go1.21.0)
	gomodifytags:	/home/redacted/go/bin/gomodifytags	(version: v1.16.0 built with go: go1.21.0)
	impl:	/home/redacted/go/bin/impl	(version: v1.1.0 built with go: go1.21.0)
	goplay:	/home/redacted/go/bin/goplay	(version: v1.0.0 built with go: go1.21.0)
	dlv:	/home/redacted/go/bin/dlv	(version: v1.21.0 built with go: go1.21.0)
	staticcheck:	/home/redacted/go/bin/staticcheck	(version: v0.4.5 built with go: go1.21.0)
	gopls:	/home/redacted/go/bin/gopls	(version: v0.14.1 built with go: go1.21.3)

go env
Workspace Folder (root): /home/redacted/projects/app/app-core
	GO111MODULE=''
	GOARCH='amd64'
	GOBIN=''
	GOCACHE='/home/redacted/.cache/go-build'
	GOENV='/home/redacted/.config/go/env'
	GOEXE=''
	GOEXPERIMENT=''
	GOFLAGS=''
	GOHOSTARCH='amd64'
	GOHOSTOS='linux'
	GOINSECURE=''
	GOMODCACHE='/home/redacted/go/pkg/mod'
	GONOPROXY=''
	GONOSUMDB=''
	GOOS='linux'
	GOPATH='/home/redacted/go'
	GOPRIVATE=''
	GOPROXY='https://proxy.golang.org,direct'
	GOROOT='/home/linuxbrew/.linuxbrew/Cellar/go/1.21.3/libexec'
	GOSUMDB='sum.golang.org'
	GOTMPDIR=''
	GOTOOLCHAIN='auto'
	GOTOOLDIR='/home/linuxbrew/.linuxbrew/Cellar/go/1.21.3/libexec/pkg/tool/linux_amd64'
	GOVCS=''
	GOVERSION='go1.21.3'
	GCCGO='gccgo'
	GOAMD64='v1'
	AR='ar'
	CC='cc'
	CXX='c++'
	CGO_ENABLED='1'
	GOMOD='/dev/null'
	GOWORK=''
	CGO_CFLAGS='-O2 -g'
	CGO_CPPFLAGS=''
	CGO_CXXFLAGS='-O2 -g'
	CGO_FFLAGS='-O2 -g'
	CGO_LDFLAGS='-O2 -g'
	PKG_CONFIG='pkg-config'
	GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2930060647=/tmp/go-build -gno-record-gcc-switches'
	
Workspace Folder (api-global): /home/redacted/projects/app/app-core/api-global
	GO111MODULE=''
	GOARCH='amd64'
	GOBIN=''
	GOCACHE='/home/redacted/.cache/go-build'
	GOENV='/home/redacted/.config/go/env'
	GOEXE=''
	GOEXPERIMENT=''
	GOFLAGS=''
	GOHOSTARCH='amd64'
	GOHOSTOS='linux'
	GOINSECURE=''
	GOMODCACHE='/home/redacted/go/pkg/mod'
	GONOPROXY=''
	GONOSUMDB=''
	GOOS='linux'
	GOPATH='/home/redacted/go'
	GOPRIVATE=''
	GOPROXY='https://proxy.golang.org,direct'
	GOROOT='/home/linuxbrew/.linuxbrew/Cellar/go/1.21.3/libexec'
	GOSUMDB='sum.golang.org'
	GOTMPDIR=''
	GOTOOLCHAIN='auto'
	GOTOOLDIR='/home/linuxbrew/.linuxbrew/Cellar/go/1.21.3/libexec/pkg/tool/linux_amd64'
	GOVCS=''
	GOVERSION='go1.21.3'
	GCCGO='gccgo'
	GOAMD64='v1'
	AR='ar'
	CC='cc'
	CXX='c++'
	CGO_ENABLED='1'
	GOMOD='/dev/null'
	GOWORK=''
	CGO_CFLAGS='-O2 -g'
	CGO_CPPFLAGS=''
	CGO_CXXFLAGS='-O2 -g'
	CGO_FFLAGS='-O2 -g'
	CGO_LDFLAGS='-O2 -g'
	PKG_CONFIG='pkg-config'
	GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2151347667=/tmp/go-build -gno-record-gcc-switches'

Workspace Folder (api-regional): /home/redacted/projects/app/app-core/api-regional
	GO111MODULE=''
	GOARCH='amd64'
	GOBIN=''
	GOCACHE='/home/redacted/.cache/go-build'
	GOENV='/home/redacted/.config/go/env'
	GOEXE=''
	GOEXPERIMENT=''
	GOFLAGS=''
	GOHOSTARCH='amd64'
	GOHOSTOS='linux'
	GOINSECURE=''
	GOMODCACHE='/home/redacted/go/pkg/mod'
	GONOPROXY=''
	GONOSUMDB=''
	GOOS='linux'
	GOPATH='/home/redacted/go'
	GOPRIVATE=''
	GOPROXY='https://proxy.golang.org,direct'
	GOROOT='/home/linuxbrew/.linuxbrew/Cellar/go/1.21.3/libexec'
	GOSUMDB='sum.golang.org'
	GOTMPDIR=''
	GOTOOLCHAIN='auto'
	GOTOOLDIR='/home/linuxbrew/.linuxbrew/Cellar/go/1.21.3/libexec/pkg/tool/linux_amd64'
	GOVCS=''
	GOVERSION='go1.21.3'
	GCCGO='gccgo'
	GOAMD64='v1'
	AR='ar'
	CC='cc'
	CXX='c++'
	CGO_ENABLED='1'
	GOMOD='/home/redacted/projects/app/app-core/api-regional/go.mod'
	GOWORK=''
	CGO_CFLAGS='-O2 -g'
	CGO_CPPFLAGS=''
	CGO_CXXFLAGS='-O2 -g'
	CGO_FFLAGS='-O2 -g'
	CGO_LDFLAGS='-O2 -g'
	PKG_CONFIG='pkg-config'
	GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2075772077=/tmp/go-build -gno-record-gcc-switches'

Share the Go related settings you have added/edited

{
  "go.toolsManagement.autoUpdate": true,
  "gopls": {
    "ui.documentation.linksInHover": false
  }
}

Describe the bug

Trying to goto the definition/source of imports results in triggering of both the goto definition action (expected) and the opening of the documentation on the browser. (Screen-recording attached)

Steps to reproduce the behavior:

  1. Open any go project
  2. Do a cmd+click to goto the definition of any of the imports

Screenshots or recordings

Screen.Recording.2023-11-10.at.5.29.26.PM.mp4
@gopherbot gopherbot added this to the Untriaged milestone Nov 10, 2023
@niranjan94
Copy link
Author

Setting the following solves this. My bad for not digging into the settings more in detail.

"gopls.ui.navigation.importShortcut": "Definition"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants