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: disable package-oriented diagnostics for files/directories whose names begin with "."/"_" #60527

Open
hyangah opened this issue May 31, 2023 · 0 comments
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

@hyangah
Copy link
Contributor

hyangah commented May 31, 2023

Gopls version: v0.12.0

How to reproduce

  1. Clone and open the delve project (github.com/go-delve/delve). There should be no diagnostics.
  2. Open one of the files in _fixtures. Gopls is publishing ~570 compiler errors (mostly, DuplicateDecl)
  3. Close the file. The diagnostics don't go away.

The directory _fixtures contain various files used for debugging. Depending on debugging scenario, mostly a single file is chosen to be built and debugged by tests. They are like testdata.

According to the go command line doc https://pkg.go.dev/cmd/go#hdr-Package_lists_and_patterns files in this directory are handled specially. But gopls's behavior doesn't seem to align with it.

Directory and file names that begin with "." or "_" are ignored by the go tool, as are directories named "testdata".

I'd appreciate completion or single file mode diagnostics on the files, but not DuplicateDecl diagnostics.

Alternatives to consider

  • Provide an option to disable diagnostics on files in certain directories. -> Should this be editor's option?
  • Unpublish diagnostics once the files in _fixtures are all closed. -> Still distracting.
  • Ask users to use build tags. (//go:build ignore) -> at least, for delve, this will be a huge change since most tests are sensitive to file line number changes (e.g. setting breakpoint).
@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 May 31, 2023
@gopherbot gopherbot added this to the Unreleased milestone May 31, 2023
@findleyr findleyr modified the milestones: Unreleased, gopls/v0.13.0 Jun 15, 2023
@findleyr findleyr modified the milestones: gopls/v0.14.0, gopls/v0.15.0 Oct 9, 2023
@findleyr findleyr modified the milestones: gopls/v0.15.0, gopls/v0.16.0 Jan 17, 2024
@findleyr findleyr modified the milestones: gopls/v0.16.0, gopls/v0.17.0 Mar 13, 2024
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