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/cmd/gopls: Go to definition failed on vscode-remote ssh #33683

Closed
wasd96040501 opened this issue Aug 16, 2019 · 2 comments
Closed

x/tools/cmd/gopls: Go to definition failed on vscode-remote ssh #33683

wasd96040501 opened this issue Aug 16, 2019 · 2 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls.
Milestone

Comments

@wasd96040501
Copy link

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

$ go version
go version go1.12.8 linux/amd64

Does this issue reproduce with the latest release?

yes
I run
go get -u golang.org/x/tools/gopls@latest

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/luoyangze/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/luoyangze/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="/dev/null"
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-build213559077=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I connected a remote server using vscode remote-ssh.
Then I try to go to definition, but it let me waiting for long time and nothing happened, or just a "no definition found"

I run
gopls -rpc.trace -v check main.go
and It looks good

➜  make-up-util git:(master) gopls -rpc.trace -v check main.go
2019/08/16 19:05:45 Info:2019/08/16 19:05:45 14.582591ms for GOROOT=/usr/local/go GOPATH=/home/luoyangze/go GO111MODULE=on PWD=/data00/home/luoyangze/go/src/xxx/luoyangze/make-up-util go "env" "GOMOD", stderr: <<>>
2019/08/16 19:05:45 Info:2019/08/16 19:05:45 69.715526ms for GOROOT=/usr/local/go GOPATH=/home/luoyangze/go GO111MODULE=on PWD=/data00/home/luoyangze/go/src/xxx/luoyangze/make-up-util go "list" "-e" "-json" "-compiled=true" "-test=true" "-export=false" "-deps=true" "-find=false" "--" "builtin", stderr: <<>>
2019/08/16 19:05:45 Info:2019/08/16 19:05:45 86.334874ms for GOROOT=/usr/local/go GOPATH=/home/luoyangze/go GO111MODULE=on PWD=/data00/home/luoyangze/go/src/xxx/luoyangze/make-up-util go "list" "-m" "-json" "all", stderr: <<>>
2019/08/16 19:05:45 Info:2019/08/16 19:05:45 Build info
----------
golang.org/x/tools/gopls v0.1.3
    golang.org/x/tools/gopls@v0.1.4-0.20190815235612-5b08f89bfc0c h1:wDldOX8MHGWBtRh79PEC4UcFXDGk0GALoA8RZViW1oA=
    golang.org/x/sync@v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
    golang.org/x/tools@v0.0.0-20190815235612-5b08f89bfc0c h1:7eYQMBMvMxbxtNK/jCq9umo/V/QiO5CLoIzIpSYM1i4=
    golang.org/x/xerrors@v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc=

Go info
-------
go version go1.12.8 linux/amd64

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/luoyangze/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/luoyangze/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="/data00/home/luoyangze/go/src/xxx/luoyangze/make-up-util/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-build826893110=/tmp/go-build -gno-record-gcc-switches"
2019/08/16 19:05:45 Info:2019/08/16 19:05:45 11.349639ms for GOROOT=/usr/local/go GOPATH=/home/luoyangze/go GO111MODULE=on PWD=/data00/home/luoyangze/go/src/xxx/luoyangze/make-up-util go "env" "GOMOD", stderr: <<>>
2019/08/16 19:05:45 Info:2019/08/16 19:05:45 75.344199ms for GOROOT=/usr/local/go GOPATH=/home/luoyangze/go GO111MODULE=on PWD=/data00/home/luoyangze/go/src/xxx/luoyangze/make-up-util go "list" "-m" "-json" "all", stderr: <<>>
2019/08/16 19:05:46 Info:2019/08/16 19:05:46 315.027053ms for GOROOT=/usr/local/go GOPATH=/home/luoyangze/go GO111MODULE=on PWD=/data00/home/luoyangze/go/src/xxx/luoyangze/make-up-util go "list" "-e" "-json" "-compiled=true" "-test=true" "-export=false" "-deps=true" "-find=false" "--" "/data00/home/luoyangze/go/src/xxx/luoyangze/make-up-util", stderr: <<>>
2019/08/16 19:05:46 Info:2019/08/16 19:05:46 go/packages.Load
        package = xxx/webcast/make-up-util
        files = [/data00/home/luoyangze/go/src/xxx/luoyangze/make-up-util/main.go]
2019/08/16 19:05:46 Info:2019/08/16 19:05:46 go/packages.Load
        packages = 1

But in vscode output panel, I got:

[Trace - 6:46:51 PM] Received notification 'window/logMessage' in 0ms.
Params: {"type":3,"message":"2019/08/16 18:46:51 10.982048ms for GOROOT=/usr/local/go GOPATH=/home/luoyangze/go GO111MODULE=on PWD=/home/luoyangze/go/src/xxx go \"list\" \"-e\" \"-json\" \"-compiled=true\" \"-test=true\" \"-export=false\" \"-deps=true\" \"-find=false\" \"--\" \"/home/luoyangze/go/src/xxx/luoyangze/make-up-util\", stderr: \u003c\u003cgo: cannot find main module; see 'go help modules'\n\u003e\u003e\n"}

What did you expect to see?

go to definition

What did you see instead?

nothing happened or "definition not found"

@gopherbot gopherbot added this to the Unreleased milestone Aug 16, 2019
@gopherbot gopherbot added the gopls Issues related to the Go language server, gopls. label Aug 16, 2019
@stamblerre
Copy link
Contributor

How are you opening VSCode? Are you opening the directory that contains the go.mod file?

@wasd96040501
Copy link
Author

@stamblerre Thanks for your reply and your solution. It has solved when I open the directory that cotains the go.mod file.

@golang golang locked and limited conversation to collaborators Aug 19, 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

3 participants