Vim-go: error installing gopls

Created on 2 Jul 2019  路  5Comments  路  Source: fatih/vim-go

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

run the GoUpdateBinaries command in neovim

What did you expect to happen?

all the tools should be installed automatically

What happened instead?

there's an error when installing gopls:
Error installing golang.org/x/tools/gopls@latest: go: cannot find main module; see 'go help modules'

Configuration (MUST fill this out):

let g:go_fmt_command        = 'goimports' 
let g:go_def_mode           = 'gopls'  
let g:go_metalinter_command = 'golangci-lint' 

vim-go version:

latest(c67d72c476ff08bd631588429ef47d0aee75af27)

vimrc you used to reproduce (use a minimal vimrc with other plugins disabled; do not link to a 2,000 line vimrc):

vimrc

let g:go_fmt_command = 'goimports'
let g:go_def_mode = 'gopls'
let g:go_metalinter_command = 'golangci-lint'

Vim version (first three lines from :version):


neovim 0.3.4

Go version (go version):


go version go1.11.11 linux/amd64

Go environment

go env Output:


GOARCH="amd64"
GOBIN="/home/s/go/bin"
GOCACHE="/home/s/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/s/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/s/.vim/plugged/vim-go/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build046431507=/tmp/go-build -gno-record-gcc-switches"

Most helpful comment

This is happening because you're using go 1.11. If you'll upgrade to go 1.12, then :GoUpdateBinaries will work as expected.

Upgrading to 1.12 did fix the problem, thanks for the tip :)
Perhaps you should add this requirement to README

All 5 comments

I get similar error when running the command go get -u golang.org/x/tools/gopls@latest in the terminal.

To make this work, I have to cd into $GOPATH/src/golang.org/x/tools/ and then run the go get command

Do you have $GO111MODULE set?

Do you have $GO111MODULE set?

I have the same error with GO111MODULE set to on/off.
Unsetting GO111MODULE doesn't help either

This is happening because you're using go 1.11. If you'll upgrade to go 1.12, then :GoUpdateBinaries will work as expected.

This is happening because you're using go 1.11. If you'll upgrade to go 1.12, then :GoUpdateBinaries will work as expected.

Upgrading to 1.12 did fix the problem, thanks for the tip :)
Perhaps you should add this requirement to README

Was this page helpful?
0 / 5 - 0 ratings

Related issues

surest picture surest  路  3Comments

preslavmihaylov picture preslavmihaylov  路  3Comments

MattFlower picture MattFlower  路  4Comments

svanharmelen picture svanharmelen  路  3Comments

Michael-F-Ellis picture Michael-F-Ellis  路  3Comments