Skip to content

gopls not found if GOBIN not defined in environment #3753

Description

@carlosonunez

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

  1. Install asdf through Homebrew on MacOS and added the golang extension to manage Go versions
brew install asdf
asdf plugin add golang

NOTE: I did not add . ${ASDF_DATA_DIR:-$HOME/.asdf}/plugins/golang/set-env.bash to my bashrc as directed, as I build with Golang in Docker or Podman almost exclusively and only install it for vim-go to work.

  1. Create a .tool-versions in my $HOME that installs Golang 1.26.5 by default:
cat >$HOME/.tool-versions <<-EOF
golang 1.26.5
  1. Run asdf install to install Golang.

  2. Clone a Git project that has a .tool-versions file like the below, then cd'ed into that directory:

golang 1.21.1
  1. Open vim and installed :GoInstallBinaries as directed.

  2. Confirmed that vim-go binaries install into $(go env GOBIN).

What did you expect to happen?

gopls loads when a .go file is opened.

What happened instead?

could not find 'gopls'. Run :GoInstallBinaries to fix it

Configuration (MUST fill this out):

vim-go version:

v1.29

vimrc you used to reproduce:

vimrc
execute pathogen#infect()
" Golang specific: Lint, test, and vet on save
let g:go_jump_to_error = 0
let g:go_metalinter_autosave = 1
let g:go_metalinter_autosave_enabled = ['bugs', 'error', 'complexity', 'metalinter', 'style']
let g:go_fmt_fail_silently = 0
let g:go_search_bin_path_first = 1

Vim version (first three lines from :version):

VIM - Vi IMproved 9.2 (2026 Feb 14, compiled Jun 28 2026 19:48:02)
macOS version - arm64
Included patches: 1-750

Go version (go version):

go version go1.26.5 darwin/arm64

Go environment

go env Output:
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/cn/.asdf/installs/golang/1.26.5/bin'
GOCACHE='/Users/cn/Library/Caches/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/Users/cn/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/40/fq2dtqdx3ks9s0x7z_zd0d9h0000gn/T/go-build902282508=/tmp/go-build -gno-record-gcc-switches -fno-common'
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMOD='/Users/cn/src/expenses-processor/go.mod'
GOMODCACHE='/Users/cn/.asdf/installs/golang/1.26.5/packages/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/cn/.asdf/installs/golang/1.26.5/packages'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/Users/cn/.asdf/installs/golang/1.26.5/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/cn/Library/Application Support/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/Users/cn/.asdf/installs/golang/1.26.5/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.26.5'
GOWORK=''
PKG_CONFIG='pkg-config'

gopls version

gopls version Output:
golang.org/x/tools/gopls v0.23.0

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions