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: errors in std lib files #32482

Open
RobGraham opened this issue Jun 7, 2019 · 16 comments

Comments

Projects
None yet
5 participants
@RobGraham
Copy link

commented Jun 7, 2019

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

$ go version
1.12.4

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/q530/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/q530/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
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/gc/_qqxbk491f17hchg5fjmjqynxj_yzn/T/go-build840963776=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Casually programming my application. No patterns that I've been able to discover.

What did you expect to see?

gopls to only error on legitimate issues within my workspace

What did you see instead?

gopls will occasionally throw errors outside of my project. It seems to be scanning std lib dir files. The behavior seems completely random and it acts like so many other errors thrown by gopls within my workspace that aren't actual errors. Closing and reopening vs code window always resolves the problems until the next occurrence.

Screen Shot 2019-06-07 at 12 04 04 PM

@gopherbot gopherbot added this to the Unreleased milestone Jun 7, 2019

@gopherbot gopherbot added the gopls label Jun 7, 2019

@RobGraham

This comment has been minimized.

Copy link
Author

commented Jun 7, 2019

And again after merging changes from another branch
Screen Shot 2019-06-07 at 4 38 41 PM

@thepudds

This comment has been minimized.

Copy link

commented Jun 11, 2019

I’m sorry to hear you are encountering some issues.

Would you be able to supply the logs and other diagnostic information suggested in the troubleshooting section here:

https://github.com/golang/go/wiki/gopls

@stamblerre

This comment has been minimized.

Copy link
Contributor

commented Jun 12, 2019

@RobGraham: Can you try syncing to the latest version of gopls? The screenshot in your second comment, in particular, was the result of a bug that was fixed in https://golang.org/c/179921.

@RobGraham

This comment has been minimized.

Copy link
Author

commented Jun 12, 2019

@thepudds when i see the issue again i'll try grabbing the logs as it occurs.

@stamblerre That link doesn't work. How do i know what version of gopls i'm using? I'm asking out of general curiosity but also because i've been actively updating gopls probably once or twice a week because of how unstable it is hoping these behaviors would be fixed. If i know how to compare my version with what you're referring to then i could better tell if the version I'm running includes the supposed fix.

@thepudds

This comment has been minimized.

Copy link

commented Jun 12, 2019

I think that link might have been missing an l, and the correct link would be https://golang.org/cl/179921

To you get the latest version of gopls, you would run:

go get -u golang.org/x/tools/cmd/gopls

@RobGraham

This comment has been minimized.

Copy link
Author

commented Jun 12, 2019

Thank you for the correct link. And yes, i'm familiar with how to update and have done so probably twice since the 3rd which appears to be the commit date for that change.

I've been primarily using the built in Go: Install/Update Tools option in vs code. To my original question however, is there an easy way to check which version/commit of gopls i'm running locally for comparison?

@ianthehat

This comment has been minimized.

Copy link

commented Jun 12, 2019

recent versions of gopls write their version information to the log.
you can also do gopls version on the command line to print it.
Also you mention merging changes, gopls does not watch the file system (yet) so any time you make changes to files it cares about from outside the editor, it will probably break.

@RobGraham

This comment has been minimized.

Copy link
Author

commented Jun 12, 2019

I previously tried seeing if i could execute gopls in terminal but get command not found gopls

Update: It would help if i used my brain and remembered gopls is installed as a dependency in /bin so should execute my call there. However, i get

➜  bin ./gopls version
no module information, gopls not built in module mode
@stamblerre

This comment has been minimized.

Copy link
Contributor

commented Jun 12, 2019

That error message has been updated in recent commits, so I would recommend updating your gopls version to the current master. We have had some problems in the past few days, but things should have stabilized now.

@stamblerre

This comment has been minimized.

Copy link
Contributor

commented Jul 2, 2019

@RobGraham: Are you still encountering this issue on the latest version of gopls (go get golang.org/x/tools/gopls@latest)?

@stamblerre stamblerre changed the title x/tools/cmd/gopls keeps erroring on std lib files x/tools/gopls: errors in std lib files Jul 2, 2019

@RobGraham

This comment has been minimized.

Copy link
Author

commented Jul 2, 2019

@stamblerre sorry for the tardiness. Spending the time to actually stop work, sift through the logs and report back when I just need to get on hasn't been a priority for me when i can just close and reopen vs code. However our team is still experiencing annoying behaviors.

While I don't have the exact use case to report on right now, another one that plagues us a lot is when we create a new go file and add the appropriate package declaration at the top of the file and it complains after saving that foo.go is not part of a package. These are the logs that were output soon after i created the file:

[Error - 9:14:18 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: go/packages.Load: no packages found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:19 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: go/packages.Load: no packages found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:19 AM] Request textDocument/documentLink failed.
  Message: no AST for file:///Users/q530/go/src/gitlab...com/../domain/foo.go
  Code: 0 
[Error - 9:14:19 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: go/packages.Load: no packages found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:20 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: go/packages.Load: no packages found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:20 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: package gitlab...com/../domain has errors, skipping type-checking
[Error - 9:14:21 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: package gitlab...com/../domain has errors, skipping type-checking
[Info  - 9:14:21 AM] no completions found for file:///Users/q530/go/src/gitlab...com/../domain/foo.go:0:2: no AST for file:///Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:22 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: package gitlab...com/../domain has errors, skipping type-checking
[Error - 9:14:23 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: package gitlab...com/../domain has errors, skipping type-checking
[Error - 9:14:23 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: package gitlab...com/../domain has errors, skipping type-checking
[Error - 9:14:23 AM] Request textDocument/documentLink failed.
  Message: no AST for file:///Users/q530/go/src/gitlab...com/../domain/foo.go
  Code: 0 
[Error - 9:14:27 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:28 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:28 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:29 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:29 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:29 AM] Request textDocument/documentLink failed.
  Message: no AST for file:///Users/q530/go/src/gitlab...com/../domain/foo.go
  Code: 0 
[Error - 9:14:30 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:31 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:31 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:32 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:32 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:32 AM] Request textDocument/codeAction failed.
  Message: no file information for file:///Users/q530/go/src/gitlab...com/../domain/foo.go
  Code: 0 
[Error - 9:14:33 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:34 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:34 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:34 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:34 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:34 AM] Request textDocument/codeAction failed.
  Message: no file information for file:///Users/q530/go/src/gitlab...com/../domain/foo.go
  Code: 0 
[Error - 9:14:34 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:34 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:34 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:34 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:34 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:34 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:34 AM] Request textDocument/documentLink failed.
  Message: no AST for file:///Users/q530/go/src/gitlab...com/../domain/foo.go
  Code: 0 
[Error - 9:14:34 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:34 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:34 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:34 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:34 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:34 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:34 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:34 AM] Request textDocument/codeAction failed.
  Message: no token file for file:///Users/q530/go/src/gitlab...com/../domain/foo.go
  Code: 0 
[Error - 9:14:34 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:34 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:34 AM] Request textDocument/documentLink failed.
  Message: no AST for file:///Users/q530/go/src/gitlab...com/../domain/foo.go
  Code: 0 
[Error - 9:14:34 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:34 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:34 AM] Request textDocument/hover failed.
  Message: no AST for file:///Users/q530/go/src/gitlab...com/../domain/foo.go
  Code: 0 
[Error - 9:14:34 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:34 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:34 AM] Request textDocument/hover failed.
  Message: no AST for file:///Users/q530/go/src/gitlab...com/../domain/foo.go
  Code: 0 
[Error - 9:14:34 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:34 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:34 AM] unable to check package for file:///Users/q530/go/src/gitlab...com/../domain/foo.go: loadParseTypeCheck: no package found for /Users/q530/go/src/gitlab...com/../domain/foo.go
[Error - 9:14:34 AM] Request textDocument/codeAction failed.
  Message: no file information for file:///Users/q530/go/src/gitlab...com/../domain/foo.go
  Code: 0 
@RobGraham

This comment has been minimized.

Copy link
Author

commented Jul 2, 2019

I will also try to do a better job giving you guys the info you need to actually fix the bugs so our sanity is not in jeopardy.

@stamblerre

This comment has been minimized.

Copy link
Contributor

commented Jul 2, 2019

Thank you for sharing the logs. Can you share the output of gopls version? I think this behavior has improved with the more recent updates to gopls, so please update to the latest tagged version.

@RobGraham

This comment has been minimized.

Copy link
Author

commented Jul 2, 2019

Sorry, i actually conducted an update prior to replying to the thread so i won't be able to give you any insight into the version if it was at all different to latest. But i'll definitely keep an eye out for the original issue and if i don't see any evidence of it within the week, we should be able to close this issue.

Thanks again

@RobGraham

This comment has been minimized.

Copy link
Author

commented Jul 8, 2019

Hey @stamblerre not sure if this is helpful or in anyway related but I was conducting a go mod change to my dependencies and then noticed my laptops fan started taking off. The noticed the dreaded errors. Upon looking at the gopls output window, for roughly 5 minutes logs just kept spewing.

ezgif-5-8426590713f3

Screen Shot 2019-07-08 at 8 52 12 AM

@stamblerre

This comment has been minimized.

Copy link
Contributor

commented Jul 8, 2019

gopls doesn't yet watch go.mod files, so it's likely that its state would get corrupted during changes like these. For now, I'd recommend restarting your VSCode window (or Ctrl + Shift + P -> Reload Window) to get gopls back to a usable state. I know it's not the best approach, but we are currently working on having gopls watch go.mod files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.