Skip to content

Commit

Permalink
gopls/internal/cache: refine bug reports for inconsistent dep view
Browse files Browse the repository at this point in the history
The most likely cause of an inconsistent view of a dependency is a
mismatching test variant. Refine the bug report to identify this case.

For golang/go#63822

Change-Id: I1334501be1ea55a43a49557ad2cb1d03178268cc
Reviewed-on: https://go-review.googlesource.com/c/tools/+/628495
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
  • Loading branch information
findleyr committed Nov 18, 2024
1 parent e59fd36 commit b8ff201
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion gopls/internal/cache/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,16 @@ func importLookup(mp *metadata.Package, source metadata.Source) func(PackagePath
if prevID, ok := impMap[depPath]; ok {
// debugging #63822
if prevID != depID {
bug.Reportf("inconsistent view of dependencies")
prev := source.Metadata(prevID)
curr := source.Metadata(depID)
switch {
case prev == nil || curr == nil:
bug.Reportf("inconsistent view of dependencies (missing dep)")
case prev.ForTest != curr.ForTest:
bug.Reportf("inconsistent view of dependencies (mismatching ForTest)")
default:
bug.Reportf("inconsistent view of dependencies")
}
}
continue
}
Expand Down

0 comments on commit b8ff201

Please sign in to comment.