Skip to content

Commit afc6aad

Browse files
bradfitzIan Lance Taylor
authored and
Ian Lance Taylor
committed
go/packages: make loadFromExportData ignore go.shape
From Reilly Watson <[email protected]> (previous CLA) Fixes golang/go#51629 Change-Id: I5891aa568d66d9471488a957e45a2fa22a58e0a4 Reviewed-on: https://go-review.googlesource.com/c/tools/+/400034 Run-TryBot: Brad Fitzpatrick <[email protected]> gopls-CI: kokoro <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Russ Cox <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent b7d7574 commit afc6aad

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

go/packages/packages.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,6 +1234,11 @@ func (ld *loader) loadFromExportData(lpkg *loaderPackage) (*types.Package, error
12341234
if err != nil {
12351235
return nil, fmt.Errorf("reading %s: %v", lpkg.ExportFile, err)
12361236
}
1237+
if _, ok := view["go.shape"]; ok {
1238+
// Account for the pseudopackage "go.shape" that gets
1239+
// created by generic code.
1240+
viewLen++
1241+
}
12371242
if viewLen != len(view) {
12381243
log.Panicf("golang.org/x/tools/go/packages: unexpected new packages during load of %s", lpkg.PkgPath)
12391244
}

0 commit comments

Comments
 (0)