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: follow-up to golang/vscode-go#2406 (analyzer print statement breaking gopls) #54459

Open
1 of 5 tasks
findleyr opened this issue Aug 15, 2022 · 0 comments
Open
1 of 5 tasks
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@findleyr
Copy link
Contributor

findleyr commented Aug 15, 2022

This is a follow up issue for golang/vscode-go#2406. That issue reports a rare but severe breakage that made it into the gopls@v0.9.2 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 gopls@v0.9.4 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.
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Aug 15, 2022
@gopherbot gopherbot added this to the Unreleased milestone Aug 15, 2022
@findleyr findleyr modified the milestones: Unreleased, gopls/later Aug 15, 2022
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Aug 22, 2022
This release fixes an unfortunate bug in a new vet analysis in the
gopls@v0.9.2 release. Specifically, a stray print statement in a
new analyzer for the invalid time format string "2006-02-01", which
corrupts gopls' communication over STDIN/STDOUT.

This only affects projects using that bad format string, and only
when a file in the affected package is open. Thanks to @Phadin for
accurately identifying this bug so quickly after it was introduced.
Issue golang/go#54459 tracks our follow-up to prevent similar
regressions from making it into future gopls releases.

On a positive note, here is the new vet analysis in action. Clearly
it will catch real bugs!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

2 participants