Skip to content

Commit

Permalink
go/packages: make loadFromExportData ignore go.shape
Browse files Browse the repository at this point in the history
From Reilly Watson <reillywatson@gmail.com> (previous CLA)

Fixes golang/go#51629

Change-Id: I5891aa568d66d9471488a957e45a2fa22a58e0a4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/400034
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
  • Loading branch information
bradfitz authored and Ian Lance Taylor committed Apr 13, 2022
1 parent b7d7574 commit afc6aad
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions go/packages/packages.go
Expand Up @@ -1234,6 +1234,11 @@ func (ld *loader) loadFromExportData(lpkg *loaderPackage) (*types.Package, error
if err != nil {
return nil, fmt.Errorf("reading %s: %v", lpkg.ExportFile, err)
}
if _, ok := view["go.shape"]; ok {
// Account for the pseudopackage "go.shape" that gets
// created by generic code.
viewLen++
}
if viewLen != len(view) {
log.Panicf("golang.org/x/tools/go/packages: unexpected new packages during load of %s", lpkg.PkgPath)
}
Expand Down

0 comments on commit afc6aad

Please sign in to comment.