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

gopls: can't install golang.org/x/tool/gopls@latest #35868

Closed
kyoh86 opened this issue Nov 27, 2019 · 7 comments
Closed

gopls: can't install golang.org/x/tool/gopls@latest #35868

kyoh86 opened this issue Nov 27, 2019 · 7 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls.

Comments

@kyoh86
Copy link

kyoh86 commented Nov 27, 2019

Please answer these questions before submitting your issue. Thanks!

What did you do?

$ GO111MODULE=on go get golang.org/x/tools/gopls@latest

What did you expect to see?

gopls is installed.

What did you see instead?

I got the error output

go: finding golang.org/x/tools/gopls v0.2.1
go: downloading golang.org/x/tools/gopls v0.2.1
go: extracting golang.org/x/tools/gopls v0.2.1
go: downloading golang.org/x/tools v0.0.0-20191126225216-7360bd5c0f4e
go: extracting golang.org/x/tools v0.0.0-20191126225216-7360bd5c0f4e
go: downloading honnef.co/go/tools v0.0.1-2019.2.3
go: downloading github.com/sergi/go-diff v1.0.0
go: downloading golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898
go: downloading golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
go: extracting github.com/sergi/go-diff v1.0.0
go: extracting golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
go: extracting golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898
go: extracting honnef.co/go/tools v0.0.1-2019.2.3
go: downloading github.com/BurntSushi/toml v0.3.1
go: extracting github.com/BurntSushi/toml v0.3.1
go: finding golang.org/x/tools v0.0.0-20191126225216-7360bd5c0f4e
go: finding github.com/sergi/go-diff v1.0.0
go: finding honnef.co/go/tools v0.0.1-2019.2.3
go: finding golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
go: finding github.com/BurntSushi/toml v0.3.1
go: finding golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898
# golang.org/x/tools/gopls/internal/hooks
../../../../go/pkg/mod/golang.org/x/tools/gopls@v0.2.1/internal/hooks/analysis.go:17:30: first argument to append must be slice; have map[string]*analysis.Analyzer
../../../../go/pkg/mod/golang.org/x/tools/gopls@v0.2.1/internal/hooks/analysis.go:20:30: first argument to append must be slice; have map[string]*analysis.Analyzer
../../../../go/pkg/mod/golang.org/x/tools/gopls@v0.2.1/internal/hooks/analysis.go:23:30: first argument to append must be slice; have map[string]*analysis.Analyzer

Build info

golang.org/x/tools/gopls 0.2.0
    golang.org/x/tools/gopls@v0.2.0 h1:ddCHfScTYOG6auAcEKXCFN5iSeKSAnYcPv+7zVJBd+U=
    github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
    github.com/sergi/go-diff@v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
    golang.org/x/sync@v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
    golang.org/x/tools@v0.0.0-20191108194844-46f05828f2fe h1:FNzasIzfY1IIdyTs/+o3Qv1b7YdffPbBXyjZ5VJJdIA=
    golang.org/x/xerrors@v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc=
    honnef.co/go/tools@v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM=

Go info

go version go1.13.4 darwin/amd64

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/kyoh86/Library/Caches/go-build"
GOENV="/Users/kyoh86/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/kyoh86/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.13.4/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.13.4/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/kyoh86/Projects/github.com/wcl48/ai-analyst-back/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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/y8/4b8kv6r967jdyxxf8q797njr0000gn/T/go-build328153880=/tmp/go-build -gno-record-gcc-switches -fno-common"
@gopherbot
Copy link

Thank you for filing a gopls issue! Please take a look at the Troubleshooting guide, and make sure that you have provided all of the relevant information here.

@gopherbot gopherbot added the gopls Issues related to the Go language server, gopls. label Nov 27, 2019
@kyoh86
Copy link
Author

kyoh86 commented Nov 27, 2019

Sorry it's caused by my go.mod.

@kyoh86 kyoh86 closed this as completed Nov 27, 2019
@nightlyone
Copy link
Contributor

Not sure, whether I should open a new ticket here, but I could reproduce it without any go.mod by directly running

$ (GO111MODULE=on  go get -u golang.org/x/tools/gopls@latest)
go: finding golang.org/x/tools latest
go: finding golang.org/x/tools/gopls v0.2.1
go: downloading golang.org/x/tools/gopls v0.2.1
go: downloading golang.org/x/tools v0.0.0-20191209225234-22774f7dae43
go: extracting golang.org/x/tools/gopls v0.2.1
go: extracting golang.org/x/tools v0.0.0-20191209225234-22774f7dae43
go: downloading golang.org/x/tools v0.0.0-20191108194844-46f05828f2fe
go: extracting golang.org/x/tools v0.0.0-20191108194844-46f05828f2fe
go: downloading honnef.co/go/tools v0.0.1-2019.2.3
go: downloading golang.org/x/sync v0.0.0-20190423024810-112230192c58
go: downloading golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7
go: downloading github.com/sergi/go-diff v1.0.0
go: extracting golang.org/x/sync v0.0.0-20190423024810-112230192c58
go: extracting golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7
go: extracting github.com/sergi/go-diff v1.0.0
go: extracting honnef.co/go/tools v0.0.1-2019.2.3
go: downloading github.com/BurntSushi/toml v0.3.1
go: extracting github.com/BurntSushi/toml v0.3.1
go: finding golang.org/x/sync latest
go: finding github.com/BurntSushi/toml v0.3.1
go: finding honnef.co/go/tools v0.0.1-2019.2.3
go: finding github.com/sergi/go-diff v1.0.0
go: finding golang.org/x/xerrors latest
go: downloading golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
go: downloading golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
go: extracting golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
go: extracting golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
# golang.org/x/tools/gopls/internal/hooks
go/pkg/mod/golang.org/x/tools/gopls@v0.2.1/internal/hooks/analysis.go:17:30: first argument to append must be slice; have map[string]*analysis.Analyzer
go/pkg/mod/golang.org/x/tools/gopls@v0.2.1/internal/hooks/analysis.go:20:30: first argument to append must be slice; have map[string]*analysis.Analyzer
go/pkg/mod/golang.org/x/tools/gopls@v0.2.1/internal/hooks/analysis.go:23:30: first argument to append must be slice; have map[string]*analysis.Analyzer

Go version: go version go1.13.5 linux/amd64
Go env output:

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ioeser/.cache/go-build"
GOENV="/home/ioeser/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/ioeser/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/snap/go/4901"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/snap/go/4901/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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/user/1000/go-build565083837=/tmp/go-build -gno-record-gcc-switches"

@stamblerre
Copy link
Contributor

-u should not be used in conjunction with the @latest tag, as it will give you incorrect versions of the dependencies.

@shiqinfeng1
Copy link

shiqinfeng1 commented Dec 12, 2019

Sorry it's caused by my go.mod.

How to fix it? Thanks!

@stamblerre
Copy link
Contributor

@shiqinfeng1: Make sure not to run the go command in a directory with a go.mod file, as its dependencies may affect the installation of gopls. I would run the command from a temporary directory.

@Programmerino
Copy link

If you aren't using -u, don't have a go.mod and are having the issue above, try running rm -r $GOPATH/pkg/mod/golang.org/x/tools/gopls@VERSIONHERE/ in case you have a bad cache that is messing up the command. It worked for me at least.

@golang golang locked and limited conversation to collaborators Dec 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls.
Projects
None yet
Development

No branches or pull requests

6 participants