Description
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.22.5 darwin/arm64
- Run
gopls -v version
to get version of Gopls from the VS Code integrated terminal.
Build info
----------
gopls, built in GOPATH mode (unknown)
@
go: go1.22.5
- Run
code -v
orcode-insiders -v
to get version of VS Code or VS Code Insiders.
1.96.1
42b266171e51a016313f47d0c48aca9295b9cbb2
arm64
- Check your installed extensions to get the version of the VS Code Go extension
0.45.0
- Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) >
Go: Locate Configured Go Tools
command.
Tools Configuration
Environment
GOBIN: undefined
toolsGopath:
gopath: /Users/viknet/go
GOROOT: /Users/viknet/.ya/tools/v4/6608868508
PATH: /Users/viknet/.ya/tools/v4/6608868508/bin:/Users/viknet/.n/bin:/Users/viknet/.local/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/local/sbin:/Users/viknet/Library/Application Support/JetBrains/Toolbox/scripts:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/go/bin:/usr/local/munki:/Users/viknet/.cargo/bin
PATH (vscode launched with): /Users/viknet/.n/bin:/Users/viknet/.local/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/local/sbin:/Users/viknet/Library/Application Support/JetBrains/Toolbox/scripts:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/go/bin:/usr/local/munki:/Users/viknet/.cargo/bin
Tools
go: /Users/viknet/.ya/tools/v4/6608868508/bin/go: go version go1.22.5 darwin/arm64
gopls: /Users/viknet/.ya/tools/v4/gopls-darwin-arm64/gopls (version: unknown - /Users/viknet/.ya/tools/v4/gopls-darwin-arm64/gopls: go1.22.5)
gotests: not installed
gomodifytags: not installed
impl: not installed
goplay: not installed
dlv: /Users/viknet/.ya/tools/v4/6617165997/dlv (version: unknown - /Users/viknet/.ya/tools/v4/6617165997/dlv: go1.22.5)
staticcheck: /Users/viknet/go/bin/staticcheck (version: v0.5.1 built with go: go1.22.5)
Go env
Workspace Folder (devtools/dummy_arcadia/cp): /Users/viknet/arcadia2/devtools/dummy_arcadia/cp
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/viknet/Library/Caches/go-build'
GOENV='/Users/viknet/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS='-mod=vendor'
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/viknet/go/pkg/mod'
GONOPROXY='*.yandex-team.ru,*.yandexcloud.net'
GONOSUMDB='*.yandex-team.ru,*.yandexcloud.net'
GOOS='darwin'
GOPATH='/Users/viknet/go'
GOPRIVATE='*.yandex-team.ru,*.yandexcloud.net'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/Users/viknet/.ya/tools/v4/6608868508'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/Users/viknet/.ya/tools/v4/6608868508/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.5'
GCCGO='gccgo'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='0'
GOMOD='/Users/viknet/arcadia2/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 -arch arm64 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/7p/lthc_cm90ps8kpq76hfnrpd8ytg_1j/T/go-build1546548798=/tmp/go-build -gno-record-gcc-switches -fno-common'
Share the Go related settings you have added/edited
"go.toolsManagement.autoUpdate": false,
"go.toolsManagement.checkForUpdates": "off",
"go.goroot": "/Users/viknet/.ya/tools/v4/6608868508",
"go.alternateTools": {
"gopls": "/Users/viknet/.ya/tools/v4/gopls-darwin-arm64/gopls",
"dlv": "/Users/viknet/.ya/tools/v4/6617165997/dlv"
},
Describe the bug
We are using patched tools gopls
and dlv
built in GOPATH mode.
Tools version output in our case:
❯❯❯ /Users/viknet/.ya/tools/v4/6608868508/bin/go version -m /Users/viknet/.ya/tools/v4/gopls-darwin-arm64/gopls
/Users/viknet/.ya/tools/v4/gopls-darwin-arm64/gopls: go1.22.5
❯❯❯ /Users/viknet/.ya/tools/v4/6608868508/bin/go version -m /Users/viknet/.ya/tools/v4/6617165997/dlv
/Users/viknet/.ya/tools/v4/6617165997/dlv: go1.22.5
Due to the fact that the output consists of a single line, the calculation of the version fails at this line, and plugin shows warning message Tools (gopls, dlv) need recompiling to work with go version go1.22.5 darwin/arm64
every time workspace is loaded.
I'm proposing to change that line to
const moduleVersion = lines.length > 2 ? lines[2].split(/\s+/)[3] : "unknown";
With this patch I'm getting reasonable behavior:
Go: Locate Configured Go Tools
Tools Configuration
Environment
GOBIN: undefined
toolsGopath:
gopath: /Users/viknet/go
GOROOT: /Users/viknet/.ya/tools/v4/6608868508
PATH: /Users/viknet/.ya/tools/v4/6608868508/bin:/Users/viknet/.n/bin:/Users/viknet/.local/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/local/sbin:/Users/viknet/Library/Application Support/JetBrains/Toolbox/scripts:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/go/bin:/usr/local/munki:/Users/viknet/.cargo/bin
PATH (vscode launched with): /Users/viknet/.n/bin:/Users/viknet/.local/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/local/sbin:/Users/viknet/Library/Application Support/JetBrains/Toolbox/scripts:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/go/bin:/usr/local/munki:/Users/viknet/.cargo/bin
Tools
go: /Users/viknet/.ya/tools/v4/6608868508/bin/go: go version go1.22.5 darwin/arm64
gopls: /Users/viknet/.ya/tools/v4/gopls-darwin-arm64/gopls (version: unknown built with go: go1.22.5)
gotests: not installed
gomodifytags: not installed
impl: not installed
goplay: not installed
dlv: /Users/viknet/.ya/tools/v4/6617165997/dlv (version: unknown built with go: go1.22.5)
staticcheck: /Users/viknet/go/bin/staticcheck (version: v0.5.1 built with go: go1.22.5)
Go env
Workspace Folder (devtools/dummy_arcadia/cp): /Users/viknet/arcadia2/devtools/dummy_arcadia/cp
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/viknet/Library/Caches/go-build'
GOENV='/Users/viknet/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS='-mod=vendor'
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/viknet/go/pkg/mod'
GONOPROXY='*.yandex-team.ru,*.yandexcloud.net'
GONOSUMDB='*.yandex-team.ru,*.yandexcloud.net'
GOOS='darwin'
GOPATH='/Users/viknet/go'
GOPRIVATE='*.yandex-team.ru,*.yandexcloud.net'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/Users/viknet/.ya/tools/v4/6608868508'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/Users/viknet/.ya/tools/v4/6608868508/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.5'
GCCGO='gccgo'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='0'
GOMOD='/Users/viknet/arcadia2/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 -arch arm64 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/7p/lthc_cm90ps8kpq76hfnrpd8ytg_1j/T/go-build752033766=/tmp/go-build -gno-record-gcc-switches -fno-common'