Skip to content

x/tools/gopls: improve the gopls bug subcommand, and use it more widely  #60969

@findleyr

Description

@findleyr
Member

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.

Activity

added this to the gopls/v0.12.4 milestone on Jun 23, 2023
added
ToolsThis label describes issues relating to any tools in the x/tools repository.
goplsIssues related to the Go language server, gopls.
on Jun 23, 2023
gopherbot

gopherbot commented on Jun 23, 2023

@gopherbot
Contributor

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

gopherbot

gopherbot commented on Jun 28, 2023

@gopherbot
Contributor

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

added a commit that references this issue on Feb 16, 2024
14ec3c0
locked and limited conversation to collaborators on Jun 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

FrozenDueToAgeToolsThis 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

      @adonovan@gopherbot@findleyr

      Issue actions

        x/tools/gopls: improve the `gopls bug` subcommand, and use it more widely · Issue #60969 · golang/go