-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gopls/internal/cache: prune broken edges to command-line-arguments pkgs
Fix two bugs discovered during the investigation of golang/go#66109, which revealed the strange and broken intermediate test variant form "path/to/command/package [command-line-arguments.test]", referenced from the equally broken "command-line-arguments [command-line-arguments.test]". This latter package was *also* detected as an ITV, which is why we never tried to type check it in [email protected]. - Snapshot.orphanedFileDiagnostics was not pruning intermediate test variants, causing it to be the one place where we were now type checking ITVs. - Fix the latent bug that caused gopls to record a dangling edge between the two ITVs. There is a third bug in go/packages, filed as golang/go#66126. Fixes golang/go#66109 Change-Id: Ie5795b6d5a4831bf2f73217c8eb22c6ba18e59cd Reviewed-on: https://go-review.googlesource.com/c/tools/+/569035 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Alan Donovan <[email protected]>
- Loading branch information
Showing
3 changed files
with
45 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
gopls/internal/test/marker/testdata/fixedbugs/issue66109.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
This test exercises the crash in golang/go#66109: a dangling reference due to | ||
test variants of a command-line-arguments package. | ||
|
||
-- flags -- | ||
-min_go=go1.22 | ||
|
||
-- go.mod -- | ||
module example.com/tools | ||
|
||
go 1.22 | ||
|
||
-- tools_test.go -- | ||
//go:build tools | ||
|
||
package tools //@diag("tools", re"No packages found") | ||
|
||
import ( | ||
_ "example.com/tools/tool" | ||
) | ||
|
||
-- tool/tool.go -- | ||
package main | ||
|
||
func main() { | ||
} |