]> Cypherpunks repositories - gostls13.git/commit
cmd/go: change list -compiled to populate new CompiledGoFiles list
authorRuss Cox <rsc@golang.org>
Sun, 29 Jul 2018 13:26:24 +0000 (09:26 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 1 Aug 2018 00:35:19 +0000 (00:35 +0000)
commit53859e575ba0f0b84914e7dc5c2a09b6b0c5d96f
tree619652a873d4e223e92d2b09b9b5694df00b3b0a
parent6121987a10b2c54bc4c48473353205753d91f807
cmd/go: change list -compiled to populate new CompiledGoFiles list

CL 108156 added -cgo during the Go 1.11 cycle.
To avoid adding a new field to Package, it redefined the
meaning of the CgoFiles list to be the cgo output instead
of the cgo input.

This was awkward in the go command itself, since the meaning
of the list changed midway through the build.

But, worse, it is awkward to users of go list.
When gathering information about a tree of packages,
we may want the names of both the cgo inputs and the cgo outputs
(golang.org/x/tools/go/packages does, it turns out),
or when combined with -deps (CL 107776),
we may only care about one list or the other depending
on whether the package was requested explicitly or is
being returned as a dependency.

Also, it's not general enough. SWIGFiles turn into cgo files
and then end up in the list too. And maybe there will be others
in the future. What clients really want is the list of files that
are presented to the go compiler, so that they can parse
and type-check them as if they were the compiler instead.

Eliminate all this awkwardness by dropping -cgo and adding
a new -compiled that populates a new CompiledGoFiles list.

Change-Id: I5f152da17cfb2692eedde61721d01ec13067c57d
Reviewed-on: https://go-review.googlesource.com/126695
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
src/cmd/cgo/ast.go
src/cmd/cgo/util.go
src/cmd/go/go_test.go
src/cmd/go/internal/list/list.go
src/cmd/go/internal/load/pkg.go
src/cmd/go/internal/work/action.go
src/cmd/go/internal/work/exec.go