@@ -28,7 +28,10 @@ func TestShallowStd(t *testing.T) {
28
28
// Load import graph of the standard library.
29
29
// (No parsing or type-checking.)
30
30
cfg := & packages.Config {
31
- Mode : packages .LoadImports ,
31
+ Mode : packages .NeedImports |
32
+ packages .NeedName |
33
+ packages .NeedFiles | // see https://github.com/golang/go/issues/56632
34
+ packages .NeedCompiledGoFiles ,
32
35
Tests : false ,
33
36
}
34
37
pkgs , err := packages .Load (cfg , "std" )
@@ -111,7 +114,6 @@ func typecheck(t *testing.T, ppkg *packages.Package) {
111
114
insert func (p * types.Package , name string )
112
115
importMap = make (map [string ]* types.Package ) // keys are PackagePaths
113
116
)
114
-
115
117
loadFromExportData := func (imp * packages.Package ) (* types.Package , error ) {
116
118
data := []byte (imp .ExportFile )
117
119
return gcimporter .IImportShallow (fset , importMap , data , imp .PkgPath , insert )
@@ -125,13 +127,12 @@ func typecheck(t *testing.T, ppkg *packages.Package) {
125
127
if err != nil {
126
128
t .Fatalf ("unmarshal: %v" , err )
127
129
}
128
- obj := imported .Scope ().Lookup (name )
129
- if obj == nil {
130
- t .Fatalf ("lookup %q.%s failed" , imported .Path (), name )
131
- }
132
130
if imported != p {
133
131
t .Fatalf ("internal error: inconsistent packages" )
134
132
}
133
+ if obj := imported .Scope ().Lookup (name ); obj == nil {
134
+ t .Fatalf ("lookup %q.%s failed" , imported .Path (), name )
135
+ }
135
136
}
136
137
137
138
cfg := & types.Config {
0 commit comments