go/packages: expand CompiledGoFiles workaround
Updates golang/go#28749 Change-Id: I76eb264f61b511fec7e05cef1bdd35e1c7fd603b Reviewed-on: https://go-review.googlesource.com/c/163597 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org>
This commit is contained in:
parent
f727befe75
commit
8dcc6e70cd
|
@ -620,16 +620,25 @@ func golistDriverCurrent(cfg *Config, words ...string) (*driverResponse, error)
|
||||||
OtherFiles: absJoin(p.Dir, otherFiles(p)...),
|
OtherFiles: absJoin(p.Dir, otherFiles(p)...),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Workaround for https://golang.org/issue/28749.
|
// Work around https://golang.org/issue/28749:
|
||||||
// TODO(adonovan): delete before go1.12 release.
|
// cmd/go puts assembly, C, and C++ files in CompiledGoFiles.
|
||||||
|
// Filter out any elements of CompiledGoFiles that are also in OtherFiles.
|
||||||
|
// We have to keep this workaround in place until go1.12 is a distant memory.
|
||||||
|
if len(pkg.OtherFiles) > 0 {
|
||||||
|
other := make(map[string]bool, len(pkg.OtherFiles))
|
||||||
|
for _, f := range pkg.OtherFiles {
|
||||||
|
other[f] = true
|
||||||
|
}
|
||||||
|
|
||||||
out := pkg.CompiledGoFiles[:0]
|
out := pkg.CompiledGoFiles[:0]
|
||||||
for _, f := range pkg.CompiledGoFiles {
|
for _, f := range pkg.CompiledGoFiles {
|
||||||
if strings.HasSuffix(f, ".s") {
|
if other[f] {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
out = append(out, f)
|
out = append(out, f)
|
||||||
}
|
}
|
||||||
pkg.CompiledGoFiles = out
|
pkg.CompiledGoFiles = out
|
||||||
|
}
|
||||||
|
|
||||||
// Extract the PkgPath from the package's ID.
|
// Extract the PkgPath from the package's ID.
|
||||||
if i := strings.IndexByte(pkg.ID, ' '); i >= 0 {
|
if i := strings.IndexByte(pkg.ID, ' '); i >= 0 {
|
||||||
|
|
Loading…
Reference in New Issue