Go version

go version go1.22.4 darwin/arm64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/j2gg0s/Library/Caches/go-build'
GOENV='/Users/j2gg0s/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/j2gg0s/go/pkg/mod'
GONOPROXY='dev.msh.team,ohai.bot,github.com/j2gg0s'
GONOSUMDB='dev.msh.team,ohai.bot,github.com/j2gg0s'
GOOS='darwin'
GOPATH='/Users/j2gg0s/go'
GOPRIVATE='dev.msh.team,ohai.bot,github.com/j2gg0s'
GOPROXY='https://goproxy.cn,direct'
GOROOT='/Users/j2gg0s/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.4.darwin-arm64'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/Users/j2gg0s/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.4.darwin-arm64/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.4'
GCCGO='gccgo'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/j2gg0s/go/src/github.com/j2gg0s/gist/vimgo/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 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/3g/291pfdd54f11rlb15_hbq1dr0000gn/T/go-build2108187988=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

Call GoDef in vim-go with Go>=1.22

What did you see happen?

When invoke the go in src, it fails to execute because it can't infer then correct version.

➜  json pwd
/Users/j2gg0s/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.4.darwin-arm64/src/encoding/json
➜  json go env GOMOD
go: downloading go1.22 (darwin/arm64)
go: download go1.22 for darwin/arm64: toolchain not available

vim-go and others will switch to the target directory to execute relevant commands, such as go env, before invoking gopls. Link issue: https://github.com/fatih/vim-go/issues/3669

What did you expect to see?

In the src files download by toolchain, change the version in go.mod from go1.22 to go1.22.x

Comment From: seankhliao

See #62278 future versions of go will treat it as 1.22.0.