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 the gopls bug subcommand, and use it more widely #60969

Closed
1 of 3 tasks
findleyr opened this issue Jun 23, 2023 · 2 comments
Closed
1 of 3 tasks
Assignees
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 Jun 23, 2023

Following https://go.dev/issue/60963, we had a discussion around when it is correct to use log.Fatal, panic, or bug.Reportf, when encountering an "impossible" condition in gopls.

Summarizing conclusions:

  • If it is at all possible to proceed, use bug.Reportf or bug.Errorf and keep going. (the bug package was written to allow making gopls incrementally more assertive, without crashing).
  • If it is impossible to proceed, and the condition is provably impossible, use log.Fatal
  • If it is impossible to proceed, and we can't prove that the condition is impossible, use panic (this will allow VS Code crash reporting to capture the stack, among other things).

Action items:

  • populate the issue template created by the gopls bug subcommand with any bug reports captured in the file cache
  • don't just write the first bug report to the file cache: write one exemplar per callsite, and (maybe) track a count per callsite
  • add a section on error handling to a contributor guide inside the x/tools/gopls/doc directory.
@findleyr findleyr added this to the gopls/v0.12.4 milestone Jun 23, 2023
@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 Jun 23, 2023
@findleyr findleyr modified the milestones: gopls/v0.12.4, gopls/v0.12.5 Jun 23, 2023
@gopherbot
Copy link

Change https://go.dev/cl/505579 mentions this issue: gopls/internal/lsp/cmd: list bug reports in 'gopls bug'

gopherbot pushed a commit to golang/tools that referenced this issue Jun 26, 2023
This change causes gopls bug to print cached bug reports to stdout,
and to summarize them (by file:line) in the GitHub Issue form.
We don't post the bug contents, but we invite the user to copy
them.

Also, move the undocumented bug injection (for testing) from
'gopls stats' to 'gopls bug'.

Updates golang/go#60969

Change-Id: I19648e978dca3b74954d17ac449e22537c5f1e02
Reviewed-on: https://go-review.googlesource.com/c/tools/+/505579
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
@gopherbot
Copy link

Change https://go.dev/cl/506938 mentions this issue: gopls/doc/contributing.md: document error handling strategies

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

3 participants