go/packages: fix test failing on go1.10

The legacy implementation currently always loads from source code, so
packages are more complete than expected.

Change-Id: Ib8c9f7ac590038108dba05c1f47d22e70734945c
Reviewed-on: https://go-review.googlesource.com/130095
Reviewed-by: Michael Matloob <matloob@golang.org>
This commit is contained in:
Alan Donovan 2018-08-20 16:53:32 -04:00
parent 44ec670fe7
commit c1406c36ef
1 changed files with 6 additions and 6 deletions

View File

@ -665,10 +665,6 @@ func TestLoadSyntaxOK(t *testing.T) {
t.Errorf("wrong import graph: got <<%s>>, want <<%s>>", graph, wantGraph)
}
// TODO(matloob): The legacy go list based support loads everything from source
// because it doesn't do a build and the .a files don't exist.
// Can we simulate its existence?
for _, test := range []struct {
id string
wantSyntax bool
@ -681,8 +677,12 @@ func TestLoadSyntaxOK(t *testing.T) {
{"e", false, false}, // export data package
{"f", false, false}, // export data package
} {
if usesOldGolist && !test.wantSyntax {
// legacy go list always upgrades to LoadAllSyntax, syntax will be filled in.
// TODO(matloob): The legacy go list based support loads
// everything from source because it doesn't do a build
// and the .a files don't exist.
// Can we simulate its existence?
if usesOldGolist {
test.wantComplete = true
test.wantSyntax = true
}
p := all[test.id]