Closed
Description
What version of Go are you using (go version
)?
$ go version go version go1.12.5 linux/amd64 $ go list -m golang.org/x/tools golang.org/x/tools v0.0.0-20190524210228-3d17549cdc6b
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="/home/myitcv/gostuff/src/github.com/myitcv/govim/cmd/govim/.bin" GOCACHE="/home/myitcv/.cache/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="/home/myitcv/gostuff" GOPROXY="https://proxy.golang.org/" GORACE="" GOROOT="/home/myitcv/gos" GOTMPDIR="" GOTOOLDIR="/home/myitcv/gos/pkg/tool/linux_amd64" GCCGO="gccgo" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/home/myitcv/gostuff/src/github.com/myitcv/govim/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-build230798786=/tmp/go-build -gno-record-gcc-switches"
What did you do?
Opened a file in Vim (using govim
) that is part of a package that compiles and on which tests pass; received the following error message:
failed to run analyses for file:///home/myitcv/gostuff/src/github.com/myitcv/govim/cmd/govim/main.go: analysis skipped due to errors in package: [/home/myitcv/gos/src/net/lookup_unix.go:324:23: undeclared name: cgoLookupPTR /home/myitcv/gos/src/net/lookup_unix.go:124:24: undeclared name: cgoLooku
pCNAME /home/myitcv/gos/src/net/lookup_unix.go:108:23: undeclared name: cgoLookupPort /home/myitcv/gos/src/net/lookup_unix.go:96:24: undeclared name: cgoLookupIP /home/myitcv/gos/src/net/lookup_unix.go:81:24: undeclared name: cgoLookupHost]
This appears to have been introduced as part of https://go-review.googlesource.com/c/tools/+/178681
What did you expect to see?
No error message.
What did you see instead?
The above error message.
Metadata
Metadata
Assignees
Labels
Type
Projects
Relationships
Development
No branches or pull requests
Activity
stamblerre commentedon May 25, 2019
Is this error message logged or shown as a diagnostic? That CL changed it so that it would not show that diagnostic message anymore.
myitcv commentedon May 25, 2019
Sorry, I forgot to include that critical detail: it's logged.
myitcv commentedon May 25, 2019
It comes through as an error message though; so my expectation was the user should know about it. i.e. there has been an error, something has gone wrong.
jan-xyz commentedon May 26, 2019
I encounter the same error. It occurs when I freshly start vim. If I leave the file/buffer open for a while it starts working after a minute or so. I haven't found the right timing yet. I just opened the buffer switched to this tab to describe the problem, went back to verify the error and the error was gone. I tried that a few times and it seemed to solve the error. Could it be that the server needs a while to start?
I found this recent change which you labeled as "fixing a race condition" and it is concerned with package scanning. If I install
gopls
before that commit, the error is gone.golang/tools@d532c07
My setup is
neovim
withlanguageClient-neovim
andgopls
. If I can help in any way hit me up!myitcv commentedon May 26, 2019
I think the other point to note, at least in my case, is that there should not be any type checking errors. The package in question compiles without error.
mathieupost commentedon May 27, 2019
Exact same issue here with latest version from master. Package compiles, but I'm getting the same error message from gopls.
elvizlai commentedon May 28, 2019
[Error - 上午9:17:45] failed to run analyses for file:///Users/elvizlai/xxxx/main.go: analysis skipped due to errors in package: [/usr/local/Cellar/go/1.12.5/libexec/src/net/lookup_unix.go:324:23: undeclared name: cgoLookupPTR /usr/local/Cellar/go/1.12.5/libexec/src/net/lookup_unix.go:124:24: undeclared name: cgoLookupCNAME /usr/local/Cellar/go/1.12.5/libexec/src/net/lookup_unix.go:108:23: undeclared name: cgoLookupPort /usr/local/Cellar/go/1.12.5/libexec/src/net/lookup_unix.go:96:24: undeclared name: cgoLookupIP /usr/local/Cellar/go/1.12.5/libexec/src/net/lookup_unix.go:81:24: undeclared name: cgoLookupHost]
[Trace - 9:17:54 AM] Sending request 'textDocument/hover - (4)'.
zchee commentedon May 28, 2019
@elvizlai
See #29202 (comment)
stamblerre commentedon May 28, 2019
I believe that these errors are related to build tags / CGO, which is why the package compiles but still has errors. They didn't appear before because of a race condition. However, these errors are being logged, rather than published as diagnostics, so I'm wondering why they are being shown to the user? I would not expect these to be user facing errors.
gopherbot commentedon May 28, 2019
Change https://golang.org/cl/179218 mentions this issue:
internal/lsp: run analyses despite some errors
zchee commentedon May 28, 2019
@stamblerre
I think so too, occur only on darwin.
At least the autozimu/LanguageClient-neovim will display internal error if server side has error. This implements different to show diagnostic. Therefore user shown(maybe)
Note that I don't know vscode behavior.
myitcv commentedon May 28, 2019
Is this being tracked somewhere? Because there should be no errors, at least in the instance I reported here.
If an error is reported by
gopls
, what is the expectation on the client?An error of this sort suggests to me (although I'm hoping the spec is more prescriptive) "there was a problem with the language server, you should know about this"
13 remaining items