// w.Import(name) will return nil
continue
}
- pkg, _ := w.Import(name)
+ pkg, err := w.Import(name)
+ if _, nogo := err.(*build.NoGoError); nogo {
+ continue
+ }
+ if err != nil {
+ log.Fatalf("Import(%q): %v", name, err)
+ }
w.export(pkg)
}
}
info, err := context.ImportDir(dir, 0)
if err != nil {
if _, nogo := err.(*build.NoGoError); nogo {
- return nil, nil
+ return nil, err
}
log.Fatalf("pkg %q, dir %q: ScanDir: %v", name, dir, err)
}
w.export(pkg)
}
}
+
+func TestIssue29837(t *testing.T) {
+ for _, c := range contexts {
+ c.Compiler = build.Default.Compiler
+ }
+ for _, context := range contexts {
+ w := NewWalker(context, "testdata/src/issue29837")
+ _, err := w.Import("p")
+ if _, nogo := err.(*build.NoGoError); !nogo {
+ t.Errorf("expected *build.NoGoError, got %T", err)
+ }
+ }
+}