Skip to content

go version control is extremely hard and doesn't usually work #4018

@richtera

Description

@richtera

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.
    • 1.25.9
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.

Build info

golang.org/x/tools/gopls v0.21.1
golang.org/x/tools/gopls@v0.21.1 h1:1/o9z5Brdero4jFm9Jr46Uwj8GU9lQdoSXHMlwRHb/w=
github.com/BurntSushi/toml@v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg=
github.com/fatih/camelcase@v1.0.0 h1:hxNvNX/xYBp0ovncs8WyWZrOrpBNub/JfaMvbURyft8=
github.com/fatih/gomodifytags@v1.17.1-0.20250423142747-f3939df9aa3c h1:dDSgAjoOMp8da3egfz0t2S+t8RGOpEmEXZubcGuc0Bg=
github.com/fatih/structtag@v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4=
github.com/fsnotify/fsnotify@v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
github.com/google/go-cmp@v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/jsonschema-go@v0.3.0 h1:6AH2TxVNtk3IlvkkhjrtbUc4S8AvO0Xii0DxIygDg+Q=
github.com/modelcontextprotocol/go-sdk@v0.8.0 h1:jdsBtGzBLY287WKSIjYovOXAqtJkP+HtFQFKrZd4a6c=
github.com/yosida95/uritemplate/v3@v3.0.2 h1:Ed3Oyj9yrmi9087+NczuL5BwkIc4wvTb5zIM+UJPGz4=
golang.org/x/exp/typeparams@v0.0.0-20251023183803-a4bb9ffd2546 h1:HDjDiATsGqvuqvkDvgJjD1IgPrVekcSXVVE21JwvzGE=
golang.org/x/mod@v0.30.0 h1:fDEXFVZ/fmCKProc/yAXXUijritrDzahmwwefnjoPFk=
golang.org/x/sync@v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I=
golang.org/x/sys@v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
golang.org/x/telemetry@v0.0.0-20251111182119-bc8e575c7b54 h1:E2/AqCUMZGgd73TQkxUMcMla25GB9i/5HOdLr+uH7Vo=
golang.org/x/text@v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM=
golang.org/x/tools@v0.39.1-0.20260109155911-b69ac100ecb7 h1:UaaZx92hw3fDa9xRcX2//NBRE3sR4VHQLlt0TkN2geY=
golang.org/x/vuln@v1.1.4 h1:Ju8QsuyhX3Hk8ma3CesTbO8vfJD9EvUBgHvkxHBzj0I=
honnef.co/go/tools@v0.7.0-0.dev.0.20251022135355-8273271481d0 h1:5SXjd4ET5dYijLaf0O3aOenC0Z4ZafIWSpjUzsQaNho=
mvdan.cc/gofumpt@v0.8.0 h1:nZUCeC2ViFaerTcYKstMmfysj6uhQrA2vJe+2vwGU6k=
mvdan.cc/xurls/v2@v2.6.0 h1:3NTZpeTxYVWNSokW3MKeyVkz/j7uYXYiMtXRUfmjbgI=
go: go1.25.9

* Run `code -v` or `code-insiders -v` to get version of VS Code or VS Code Insiders.
	- 1.116.0 560a9dba96f961efea7b1612916f89e5d5d4d679 arm64
* Check your installed extensions to get the version of the VS Code Go extension
	- 0.52.2
* Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > `Go: Locate Configured Go Tools` command.
	- ```sh
# Tools Configuration


## Environment

GOBIN: /Users/***/.local/share/mise/installs/go/1.25.9/bin
toolsGopath: 
gopath: /Users/***/gopath
GOROOT: /Users/***/.local/share/mise/installs/go/1.25.9
PATH: /Users/***/.local/share/mise/shims:/opt/homebrew/bin:/Users/***/.meteor:/Users/***/google-cloud-sdk/bin:/opt/homebrew/opt/icu4c/bin:/opt/homebrew/opt/icu4c/sbin:/opt/homebrew/opt/postgresql@16/bin:/Users/***/Library/Android/sdk/emulator:/Users/***/Library/Android/sdk/platform-tools:/Users/***/.wasmtime/bin:/Users/***/.pyenv/shims:/Users/***/Library/pnpm:/Users/***/.bun/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/local/sbin:/Users/***/.local/bin:/usr/local/bin:/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:/opt/pmk/env/global/bin:/opt/X11/bin:/Library/Apple/usr/bin:/usr/local/MacGPG2/bin:/Applications/Wireshark.app/Contents/MacOS:/Applications/VMware Fusion.app/Contents/Public:/usr/local/go/bin:/Users/***/Library/Application Support/org.dfinity.dfx/bin:/Users/***/.rover/bin:/Users/***/.cargo/bin:/Users/***/.config/.foundry/bin:/Users/***/Development/flutter/bin:/Users/***/.docker/bin:/Users/***/.rover/bin

## Tools

	go:	/Users/***/.local/share/mise/shims/go: go version go1.25.9 darwin/arm64

	gotests:	/Users/***/.local/share/mise/installs/go/1.25.9/bin/gotests	(version: v1.6.0 built with go: go1.25.9)
	impl:	/Users/***/.local/share/mise/installs/go/1.25.9/bin/impl	(version: v1.4.0 built with go: go1.25.9)
	goplay:	/Users/***/.local/share/mise/installs/go/1.25.9/bin/goplay	(version: v1.0.0 built with go: go1.25.9)
	dlv:	/Users/***/gopath/bin/dlv	(version: v1.21.0 built with go: go1.21.1)
	gopls:	/Users/***/gopath/bin/gopls	(version: v0.16.2 built with go: go1.20.7)

## Go env

Workspace Folder (si-2): /Users/***/Development/si-2

	AR='ar'
	CC='clang'
	CGO_CFLAGS='-O2 -g'
	CGO_CPPFLAGS=''
	CGO_CXXFLAGS='-O2 -g'
	CGO_ENABLED='1'
	CGO_FFLAGS='-O2 -g'
	CGO_LDFLAGS='-O2 -g'
	CXX='clang++'
	GCCGO='gccgo'
	GO111MODULE=''
	GOARCH='arm64'
	GOARM64='v8.0'
	GOAUTH='netrc'
	GOBIN='/Users/***/.local/share/mise/installs/go/1.25.9/bin'
	GOCACHE='/Users/***/Library/Caches/go-build'
	GOCACHEPROG=''
	GODEBUG=''
	GOENV='/Users/***/Library/Application Support/go/env'
	GOEXE=''
	GOEXPERIMENT=''
	GOFIPS140='off'
	GOFLAGS=''
	GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/vp/5m13m6sx52g2y7zn2f006jdh0000gn/T/go-build1078720655=/tmp/go-build -gno-record-gcc-switches -fno-common'
	GOHOSTARCH='arm64'
	GOHOSTOS='darwin'
	GOINSECURE=''
	GOMOD='/Users/***/Development/si-2/go.mod'
	GOMODCACHE='/Users/***/gopath/pkg/mod'
	GONOPROXY=''
	GONOSUMDB=''
	GOOS='darwin'
	GOPATH='/Users/***/gopath'
	GOPRIVATE=''
	GOPROXY='https://proxy.golang.org,direct'
	GOROOT='/Users/***/.local/share/mise/installs/go/1.25.9'
	GOSUMDB='sum.golang.org'
	GOTELEMETRY='local'
	GOTELEMETRYDIR='/Users/***/Library/Application Support/go/telemetry'
	GOTMPDIR=''
	GOTOOLCHAIN='local'
	GOTOOLDIR='/Users/***/.local/share/mise/installs/go/1.25.9/pkg/tool/darwin_arm64'
	GOVCS=''
	GOVERSION='go1.25.9'
	GOWORK=''
	PKG_CONFIG='pkg-config'

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.

Describe the bug

During startup it's capturing the go version before cd into the project, so when using version managers like mise or asdf it's picking up the wrong version. This requires all project on the same machine to use the same version of go.

Steps to reproduce the behavior:

  1. Configure a project with mise.toml pointing to a different version than mise global go@VERSION
  2. Open up a terminal and do which go
  3. You end up on the wrong version

The surprising thing is that in some scenarios it works right after an upgrade but this doesn't survive a quit and restart of vscode or reload window.

Screenshots or recordings

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions