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: not working #37119

Closed
sjf3 opened this issue Feb 7, 2020 · 6 comments
Closed

x/tools/gopls: not working #37119

sjf3 opened this issue Feb 7, 2020 · 6 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

@sjf3
Copy link

sjf3 commented Feb 7, 2020

Please answer these questions before submitting your issue. Thanks!

What did you do?

click install new go please when it popped up in vs code then restart vs code

What did you expect to see? auto completions tool tips

What did you see instead? no auto completions or tool tips

Build info

golang.org/x/tools/gopls v0.3.1
    golang.org/x/tools/gopls@v0.3.1 h1:yNTWrf4gc4Or0UecjOas5pzOa3BL0WDDyKDV4Wz5VaM=
    github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
    github.com/sergi/go-diff@v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
    golang.org/x/mod@v0.1.1-0.20191105210325-c90efee705ee h1:WG0RUwxtNT4qqaXX3DPA8zHFNm/D9xaBpxzHt1WcA/E=
    golang.org/x/sync@v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
    golang.org/x/tools@v0.0.0-20200204151227-34c67990bfe7 h1:hWZVyLW37WdETuLIGQMvQIhMfXXAOANmAIEAluZMy3c=
    golang.org/x/xerrors@v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA=
    honnef.co/go/tools@v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM=
    mvdan.cc/xurls/v2@v2.1.0 h1:KaMb5GLhlcSX+e+qhbRJODnUUBvlw01jt4yrjFIHAuA=

Go info

go version go1.13.4 darwin/amd64

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/sfleeman/Library/Caches/go-build"
GOENV="/Users/sfleeman/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY="github.com/<redacted>"
GONOSUMDB="github.com/<redacted>"
GOOS="darwin"
GOPATH="/Users/<redacted>/go"
GOPRIVATE="github.com/RedVentures"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/<redacted>/go/src/github.com/<redacted>/<redacted>/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/24/sx13x65d1xd1mlpy_z33l_r88l7m4g/T/go-build773498168=/tmp/go-build -gno-record-gcc-switches -fno-common"
@gopherbot gopherbot added this to the Unreleased milestone Feb 7, 2020
@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 Feb 7, 2020
@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.

@stamblerre
Copy link
Contributor

Can you please share the output of gopls -rpc.trace -v check path/to/file.go?

@stamblerre stamblerre changed the title x/tools/gopls: x/tools/gopls: not working Feb 7, 2020
@stamblerre stamblerre modified the milestones: Unreleased, gopls/v0.4.0 Feb 7, 2020
@sjf3
Copy link
Author

sjf3 commented Feb 7, 2020

Can you please share the output of gopls -rpc.trace -v check path/to/file.go?

020/02/07 13:51:07 Info:2020/02/07 13:51:07 Build info

golang.org/x/tools/gopls v0.3.1
golang.org/x/tools/gopls@v0.3.1 h1:yNTWrf4gc4Or0UecjOas5pzOa3BL0WDDyKDV4Wz5VaM=
github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/sergi/go-diff@v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
golang.org/x/mod@v0.1.1-0.20191105210325-c90efee705ee h1:WG0RUwxtNT4qqaXX3DPA8zHFNm/D9xaBpxzHt1WcA/E=
golang.org/x/sync@v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
golang.org/x/tools@v0.0.0-20200204151227-34c67990bfe7 h1:hWZVyLW37WdETuLIGQMvQIhMfXXAOANmAIEAluZMy3c=
golang.org/x/xerrors@v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA=
honnef.co/go/tools@v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM=
mvdan.cc/xurls/v2@v2.1.0 h1:KaMb5GLhlcSX+e+qhbRJODnUUBvlw01jt4yrjFIHAuA=

Go info

go version go1.13.4 darwin/amd64

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users//Library/Caches/go-build"
GOENV="/Users//Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY="github.com/"
GONOSUMDB="github.com/"
GOOS="darwin"
GOPATH="/Users//go"
GOPRIVATE="github.com/"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/24/sx13x65d1xd1mlpy_z33l_r88l7m4g/T/go-build054596692=/tmp/go-build -gno-record-gcc-switches -fno-common"
2020/02/07 13:51:08 Info:2020/02/07 13:51:08 go/packages.Load
snapshot = 0
query = [./... builtin]
packages = 2

@stamblerre
Copy link
Contributor

Thanks! Looks like gopls is able to type-check your package fine. Can you share the logs from when completion or hover fail? Information on how to capture logs is here: https://github.com/golang/tools/blob/master/gopls/doc/troubleshooting.md#capturing-logs. Make sure to add the -rpc.trace flag in your settings so that there is more detailed output.

@sjf3
Copy link
Author

sjf3 commented Feb 7, 2020

Trace - 13:57:56.872 PM] Sending notification '$/cancelRequest'.
Params: {"id":17}

[Trace - 13:57:56.873 PM] Received response 'textDocument/hover - (17)' in 51ms.
Result: {}

2020/02/07 13:57:56 : context canceled
[Trace - 13:57:56.874 PM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2020/02/07 13:57:56 : context canceled"}

[Error - 1:57:56 PM] 2020/02/07 13:57:56 : context canceled
[Trace - 13:57:57.022 PM] Sending request 'textDocument/hover - (18)'.
Params: {"textDocument":{"uri":"file:///Users//go/src/github.com//internal/service/service.go"},"position":{"line":1243,"character":33}}

[Trace - 13:57:57.986 PM] Received response 'textDocument/hover - (18)' in 964ms.
Result: {}

[Trace - 13:57:57.986 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2020/02/07 13:57:57 go/packages.Load\n\tsnapshot = 1\n\tquery = [file=/Users//internal/service/service.go]\n\tpackages = 0"}

[Info - 1:57:57 PM] 2020/02/07 13:57:57 go/packages.Load
snapshot = 1
query = [file=/Users//go/src/github.com///internal/service/service.go]
packages = 0

@sjf3
Copy link
Author

sjf3 commented Feb 10, 2020

I figured it out. Stray character in the go.mod file makes gopls angry even though everything is vendored

@sjf3 sjf3 closed this as completed Feb 10, 2020
@golang golang locked and limited conversation to collaborators Feb 9, 2021
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