go.tools/imports: recognize exports in cgo files
Fixes golang/go#8815. LGTM=bradfitz R=bradfitz CC=golang-codereviews https://golang.org/cl/143660044
This commit is contained in:
parent
e62e5f9885
commit
b6c30b58fc
|
@ -283,7 +283,8 @@ func loadExportsGoPath(dir string) map[string]bool {
|
|||
return nil
|
||||
}
|
||||
fset := token.NewFileSet()
|
||||
for _, file := range buildPkg.GoFiles {
|
||||
for _, files := range [...][]string{buildPkg.GoFiles, buildPkg.CgoFiles} {
|
||||
for _, file := range files {
|
||||
f, err := parser.ParseFile(fset, filepath.Join(dir, file), nil, 0)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "could not parse %q: %v\n", file, err)
|
||||
|
@ -295,6 +296,7 @@ func loadExportsGoPath(dir string) map[string]bool {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return exports
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue