Skip to content

x/tools/gopls: language server stops working at valid file with "has errors, skipping type-checking" #32855

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

Closed
inliquid opened this issue Jun 29, 2019 · 14 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. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@inliquid
Copy link

VS Code, see screenshot:
изображение
These messages appear infinitely with gopls simply not working. File is valid, btw (but even if it was not, how am I supposed to work? non-sense if it can only work with files with no errors).

Tried both @latest and @master.

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

We should probably improve that error message, but that means that there were errors determining the files and dependencies for the package. Are you opening VSCode from the root of your module?

@inliquid
Copy link
Author

inliquid commented Jul 1, 2019

Yes, VS Code workspace is at the root of module.

@stamblerre
Copy link
Contributor

I know you updated to master, as per our discussion on your other issue. Do you still see these errors on master? If so, what is the output of go list -e -json -compiled -test /absolute/path/to/your/package?

@inliquid
Copy link
Author

inliquid commented Jul 1, 2019

I'll test and report.

@stamblerre stamblerre changed the title x/tools/cmd/gopls: language server stops working at valid file with "has errors, skipping type-checking" x/tools/gopls: language server stops working at valid file with "has errors, skipping type-checking" Jul 2, 2019
@stamblerre stamblerre added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jul 16, 2019
@zouyee
Copy link

zouyee commented Aug 3, 2019

for GOROOT=/usr/local/go GOPATH=/Users/xxx/Code/golang GO111MODULE=on PWD=/Users/xxx/Code/golang/src/k8s.io/kubernetes go "list" "-e" "-json" "-compiled=true" "-test=true" "-export=false" "-deps=true" "-find=false" "--" "/Users/xxx/Code/golang/src/k8s.io/kubernetes/pkg/kubelet/lifecycle", stderr: <<>>

[Error - 3:12:38 PM] Request textDocument/codeAction failed.
  Message: GetAST: unable to check package for file:///Users/xxx/Code/golang/src/k8s.io/kubernetes/pkg/kubelet/lifecycle/predicate.go: package k8s.io/kubernetes/pkg/kubelet/lifecycle has errors, skipping type-checking

same issue

@stamblerre
Copy link
Contributor

@zouyee: Please open a new issue, along with the information described here. In your case, please also add the output of go list -e -json -compiled -test /absolute/path/to/your/package. Thanks!

@stamblerre
Copy link
Contributor

@inliquid: Is this still an issue for you?

@inliquid
Copy link
Author

inliquid commented Aug 6, 2019

@stamblerre it is.

@stamblerre
Copy link
Contributor

@inliquid: What is the output of gopls -rpc.trace -v check /path/to/file.go?

@inliquid
Copy link
Author

inliquid commented Aug 6, 2019

I will check when I have time to.

@cardonator
Copy link

cardonator commented Aug 24, 2019

I'm having a similar problem to the above in gopls with a module package.

If I run gopls -rpc.trace -v check /home/bcardon/dev/app/package/base.go the output I get is:

----------
version v0.1.0, built in $GOPATH mode

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/bcardon/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/bcardon/go"
GOPROXY=""
GORACE=""
GOROOT="/snap/go/4301"
GOTMPDIR=""
GOTOOLDIR="/snap/go/4301/pkg/tool/linux_amd64"
GCCGO="gccgo"
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-build355155299=/tmp/go-build -gno-record-gcc-switches"
2019/08/24 12:07:45 Error:unable to check package for file:///home/bcardon/dev/app/package/base.go: no packages found for /home/bcardon/dev/app/package/base.go
2019/08/24 12:07:46 Error:unable to check package for file:///home/bcardon/dev/app/package/base.go: no packages found for /home/bcardon/dev/app/package/base.go
2019/08/24 12:07:46 Error:failed to deliver diagnostic for file:///home/bcardon/no%20packages%20found%20for%20/home/bcardon/dev/app/package/base.go: stat /home/bcardon/no packages found for /home/bcardon/dev/app/package/base.go: no such file or directory
check: timed out waiting for results from file:///home/bcardon/dev/app/package/base.go

edit: Nevermind, the issue I found was that one of the files in my package had the wrong package name. It would be nice if there was a way for gopls to detect that issue.

@stamblerre
Copy link
Contributor

@cardonator: it looks like you are also using an old version of gopls. You can upgrade by running “GO111MODULE=on go get golang.org/x/tools/gopls@latest”.

@cardonator
Copy link

Ah, thanks for the command. I could tell I was on an old version but not why it wasn't updating. 👍

@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Sep 12, 2019
@stamblerre
Copy link
Contributor

This issue seems to be fairly old and a lot has changed in gopls since it was filed. I'm going to close it, but please open a new issue if you encounter problems with gopls.

@golang golang locked and limited conversation to collaborators Oct 31, 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. Tools This label describes issues relating to any tools in the x/tools repository. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

5 participants