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

x/tools/gopls: "no dep handle, no metadata" #46841

Closed
suntong opened this issue Jun 20, 2021 · 3 comments
Closed

x/tools/gopls: "no dep handle, no metadata" #46841

suntong opened this issue Jun 20, 2021 · 3 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@suntong
Copy link

suntong commented Jun 20, 2021

TLDR, basically same as reported in #37786, but under Emacs, via LSP in go-mode.

What version of Go are you using (go version)?

$ go version
go version go1.15.9 linux/amd64

$ gopls version
gopls, built in GOPATH mode master
    gopls, built in GOPATH mode@master

Does this issue reproduce with the latest release?

I believe so.

What operating system and processor architecture are you using (go env)?

Debian Bullseys under Windows WSL.

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/me/.cache/go-build"
GOENV="/home/me/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/me/l/wk/Go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/me/l/wk/Go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go-1.15"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.15/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/go-build153451000=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Use gopls via LSP in go-mode under Emacs.

What did you expect to see?

  • gopls find the package under GOPATH
  • gopls able to handle symlink, and knows where the realpath are

What did you see instead?

gopls wasn't able to find the package under GOPATH.

Here is the relevant log from *lsp-log* in Emacs:

2021/06/20 18:18:25 go env for /home/me/l/gg/go-jsonfile/jsonfiddle
(root /home/me/l/gg/go-jsonfile/jsonfiddle)
(go version go version go1.15.9 linux/amd64)
(valid build configuration = false)
(build flags: [])
GOMODCACHE=/home/me/l/g;/home/me/l/wk/Go/pkg/mod
GOSUMDB=sum.golang.org
GOINSECURE=
GOPATH=/home/me/l/g;/home/me/l/wk/Go
GOPRIVATE=
GOPROXY=https://proxy.golang.org,direct
GOMOD=
GOCACHE=/home/me/.cache/go-build
GOFLAGS=
GONOSUMDB=
GOROOT=/usr/lib/go-1.15
GO111MODULE=
GONOPROXY=


2021/06/20 18:18:26 go/packages.Load
	snapshot=0
	directory=/home/me/l/gg/go-jsonfile/jsonfiddle
	query=[./ builtin]
	packages=5

2021/06/20 18:18:26 _/home/me/l/gg/go-jsonfile/jsonfiddle: no dep handle for github.com/mkideal/cli: no metadata for github.com/mkideal/cli

However, it is right there:

$ ls -d $GOPATH/src/github.com/mkideal/cli
/home/me/l/wk/Go/src/github.com/mkideal/cli

I don't know if symlink is a factor in this case, as I heavily use symlink pointing my Go code and packages around. E.g., for the /home/me/l/gg in above log:

$ ls -l ~/l/gg
lrwxrwxrwx 1 me me 16 2021-04-07 17:42 /home/me/l/gg -> g/src/github.com
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Jun 20, 2021
@gopherbot gopherbot added this to the Unreleased milestone Jun 20, 2021
@suntong suntong closed this as completed Jun 20, 2021
@suntong
Copy link
Author

suntong commented Jun 20, 2021

Ops, my GOPATH uses ";" instead of ":"

@stamblerre
Copy link
Contributor

@suntong: It also looks like you're using an old version of gopls. Can you please update by running go get golang.org/x/tools/gopls?

@suntong
Copy link
Author

suntong commented Jun 23, 2021

Oh, thanks for noticing that ❤️, done.

@golang golang locked and limited conversation to collaborators Jun 23, 2022
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. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants