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: gopls restart needed after changing build tags #54147

Closed
muirdm opened this issue Jul 30, 2022 · 4 comments
Closed

x/tools/gopls: gopls restart needed after changing build tags #54147

muirdm opened this issue Jul 30, 2022 · 4 comments
Assignees
Labels
FrozenDueToAge gopls/metadata Issues related to metadata loading in gopls 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

@muirdm
Copy link

muirdm commented Jul 30, 2022

With gopls on master (9580c84), starting with:

-- foo.go --
package main

func main() {}
-- bar.go --
package main

func main() {}
  1. Confirm you get "duplicate main" diagnostic
  2. Add "//go:build ignore" to one of the files
  3. Observe you still see the diagnostic until you restart gopls
@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 Jul 30, 2022
@gopherbot gopherbot added this to the Unreleased milestone Jul 30, 2022
@findleyr
Copy link
Contributor

findleyr commented Aug 1, 2022

This is just a bug: changes to build tags should (and probably do) invalidate packages.

The likely nature of this bug is that we don't clear diagnostics when the file is dropped from a package. I will fix this.

@findleyr findleyr self-assigned this Aug 1, 2022
@findleyr findleyr modified the milestones: Unreleased, gopls/v0.9.2 Aug 1, 2022
@findleyr
Copy link
Contributor

findleyr commented Aug 1, 2022

It looks like this bug is already fixed at tip. Bisecting.

@findleyr
Copy link
Contributor

findleyr commented Aug 1, 2022

This was fixed by https://go.dev/cl/417576. I'll close this with a passing regression test.

But the regtest I wrote is failing in the "experimental" mode. Investigating why...

@gopherbot
Copy link

Change https://go.dev/cl/420537 mentions this issue: gopls/internal/regtest: add a test that ignoring a file resolves errors

@findleyr findleyr added the gopls/metadata Issues related to metadata loading in gopls label Aug 1, 2022
@golang golang locked and limited conversation to collaborators Aug 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls/metadata Issues related to metadata loading in gopls 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