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: improve presentation of package loading failure caused by cgo errors #43307

hyangah opened this issue Dec 21, 2020 · 4 comments


Copy link

@hyangah hyangah commented Dec 21, 2020

gopls: v0.6.1

I encountered a repo that uses cgo and requires tools (e.g.pkg-config, ...) and correct configuration to build cgo.
Loading packages took a while and eventually failed because of my incomplete configuration. The PROBLEMS (diagnostics) section is flooded with hundreds of errors related to cgo types

Screen Shot 2020-12-21 at 3 36 39 PM

I could find the reasons from the gopls (server) trace channel of vscode. But it would be better to expose these error in the diagnostics page or with other means. Also, consider suppressing all the cgo-related type errors when the root cause is obvious. Finding the root cause out of hundreds of type errors seems impossible.

[Error - 3:28:30 PM] 2020/12/21 15:28:30 initial workspace load failed: go [-e -json -compiled=true -test=true -export=false -deps=true -find=false -- builtin]: exit status 2: go: downloading v0.0.0-20201031054903-ff519b6c9102
go: downloading v1.6.1
go: downloading v0.3.4
# pkg-config --cflags  -- vips vips vips vips vips vips vips vips vips vips vips vips vips vips
pkg-config: exec: "pkg-config": executable file not found in $PATH
# pkg-config --cflags  -- vips vips vips vips vips vips vips vips vips vips vips vips vips vips
pkg-config: exec: "pkg-config": executable file not found in $PATH
Copy link

@stamblerre stamblerre commented Dec 21, 2020

Was the go list error shown at the bottom of the screen? If not, that definitely seems like a problem.

@stamblerre stamblerre modified the milestones: Backlog, gopls/v1.0.0 Dec 21, 2020
@stamblerre stamblerre added this to Needs Triage in vscode-go: gopls by default via automation Dec 21, 2020
Copy link
Contributor Author

@hyangah hyangah commented Dec 21, 2020

No. I don't see any go list error message outside the gopls server trace.

Also, tried regenerate cgo definitions codelens. There was no visible change or error message, which needs improvement.

[Trace - 16:54:37.207 PM] Sending request 'workspace/executeCommand - (19)'.
Params: {"command":"gopls.regenerate_cgo","arguments":["file:///work/govips/vips/arithmetic.go"]}

[Trace - 16:54:37.209 PM] Received request 'window/workDoneProgress/create - (6)'.
Params: {"token":"6129484611666145821"}

[Trace - 16:54:37.211 PM] Sending response 'window/workDoneProgress/create - (6)' in 1ms.

[Trace - 16:54:37.211 PM] Received notification '$/progress'.
Params: {"token":"6129484611666145821","value":{"kind":"begin","title":"Regenerate cgo","cancellable":true,"message":"Running..."}}

[Trace - 16:54:37.218 PM] Received notification '$/progress'.
Params: {"token":"6129484611666145821","value":{"kind":"end","message":"gopls.regenerate_cgo: completed"}}

[Trace - 16:54:37.218 PM] Received response 'workspace/executeCommand - (19)' in 10ms.
Result: null

I happened to try but we can create a minimal repro for testing.

Copy link

@stamblerre stamblerre commented Dec 28, 2020

I have a CL to make the error message pop-up, but this also looks like a regression in #36770. Reopened that issue.

Copy link

@gopherbot gopherbot commented Dec 28, 2020

Change mentions this issue: internal/lsp: restructure the way we report critical errors

vscode-go: gopls by default automation moved this from Needs Triage to Done Dec 29, 2020
@stamblerre stamblerre modified the milestones: gopls/v1.0.0, gopls/v0.6.2 Dec 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
No open projects
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants