Skip to content

x/tools/gopls: follow-up to golang/vscode-go#2406 (analyzer print statement breaking gopls) #54459

@findleyr

Description

@findleyr

This is a follow up issue for golang/vscode-go#2406. That issue reports a rare but severe breakage that made it into the [email protected] release. Several processes broke down to let that happen, so this issue tracks improvements we can make to help avoid such regressions in the future.

Background: Gopls runs go vet analyzers for open packages. When new analyzers are added to vet (in the x/tools/go/analysis directory), they can be included in gopls via inclusion in internal/lsp/source.defaultAnalyzers. In this case, a new analyzer was added that accidentally included a print statement. Any print to stdout corrupts gopls' jsonrpc2 communication with the LSP client.

Action items (these are subject to change, as we go through our postmortem):

  • Release [email protected] containing the fix
  • Include an automated configuration diff in the gopls release process. This would have highlighted the new analyzer.
  • Add a meta test that sanity checks that all gopls analyzers are exercised by at least one test.
  • Consider redirecting os.Stdout in gopls, perhaps to os.Stderr.
  • Investigate whether we can improve the vscode-go error message when the jsonrpc2 stream gets corrupted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    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

    Issue actions