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

unknown directive: toolchain in go1.21 #3584

Closed
KaibutsuX opened this issue Sep 22, 2023 · 1 comment
Closed

unknown directive: toolchain in go1.21 #3584

KaibutsuX opened this issue Sep 22, 2023 · 1 comment

Comments

@KaibutsuX
Copy link

KaibutsuX commented Sep 22, 2023

What did you do? (required: The issue will be closed when not provided)

Attempt to follow a function definition

leader ]

What did you expect to happen?

find function definition

What happened instead?

toolbar simply says: vim-go: ..//.././././go.mod:5: unknown directive: toolchain

Configuration (MUST fill this out):

vim-go version:

Not sure how to check that, just did a git pull on the .vim repo and PluginInstall yesterday though

vimrc you used to reproduce:

vimrc

Vim version (first three lines from :version):

VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Apr 15 2023 04:26:46)
macOS version - arm64
Included patches: 1-1424

Go version (go version):

go version go1.21.1 darwin/arm64

Go environment

go env Output:
GO111MODULE=''
GOARCH='arm64'
GOBIN='/Users//go/bin'
GOCACHE='/Users//Library/Caches/go-build'
GOENV='/Users//Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users//go/pkg/mod'
GONOPROXY='gitlab.sw.com'
GONOSUMDB='gitlab.sw.com/*'
GOOS='darwin'
GOPATH='/Users//go'
GOPRIVATE='gitlab.sw.com'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR='/tmp'
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.21.1'
GCCGO='gccgo'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users//prj/sw/web/products/cdp/Code/Attribute Workers/Agenda Worker/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=/tmp/go-build1060448514=/tmp/go-build -gno-record-gcc-switches -fno-common'

gopls version

gopls version Output:
golang.org/x/tools/gopls v0.9.0
    golang.org/x/tools/gopls@v0.9.0 h1:nEKQdO89Fkt4QTCN1xXkZzYHWZoBvIhkjJMpUaqRKUU=

vim-go configuration:

vim-go configuration
g:go_highlight_operators = 1
g:go_highlight_extra_types = 1
g:go_highlight_function_calls = 1
g:go_fmt_autosave = 0
g:go_highlight_fields = 1
g:go_def_mod = 'gopls'
g:go_info_mode = 'gopls'
g:go_highlight_functions = 1
g:go_highlight_types = 1
g:go_jump_to_error = 1
g:go_imports_autosave = 0
g:go_loaded_gosnippets = 1
g:go_loaded_install = 1

filetype detection configuration:

filetype detection
filetype detection:ON  plugin:ON  indent:OFF
@bhcleek
Copy link
Collaborator

bhcleek commented Oct 2, 2023

Generally, the jump to definition functionality works well. Given that Go 1.21 added support for a toolchain directive in the go.mod file and that you're already using Go 1.21, I suspect you only need to recompile gopls. The easiest way to do that is :GoUpdateBinaries gopls.

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

No branches or pull requests

2 participants