Skip to content

x/tools/gopls: improve presentation of package loading failure caused by cgo errors #43307

Closed
@hyangah

Description

@hyangah

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 github.com/some/repo/...]: exit status 2: go: downloading golang.org/x/net v0.0.0-20201031054903-ff519b6c9102
go: downloading github.com/stretchr/testify v1.6.1
...
go: downloading golang.org/x/text 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

Activity

added
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
on Dec 21, 2020
added this to the Backlog milestone on Dec 21, 2020
added
ToolsThis label describes issues relating to any tools in the x/tools repository.
goplsIssues related to the Go language server, gopls.
on Dec 21, 2020
stamblerre

stamblerre commented on Dec 21, 2020

@stamblerre
Contributor

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

hyangah

hyangah commented on Dec 21, 2020

@hyangah
ContributorAuthor

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.
Result: 


[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 github.com/davidbyttow/govips but we can create a minimal repro for testing.

stamblerre

stamblerre commented on Dec 28, 2020

@stamblerre
Contributor

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

gopherbot

gopherbot commented on Dec 28, 2020

@gopherbot
Contributor

Change https://golang.org/cl/280093 mentions this issue: internal/lsp: restructure the way we report critical errors

locked and limited conversation to collaborators on Dec 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @cagedmantis@hyangah@stamblerre@gopherbot

        Issue actions

          x/tools/gopls: improve presentation of package loading failure caused by cgo errors · Issue #43307 · golang/go