This change adds optional Dir string and Env []string options
that are passed through to the build system's metadata query.
As with exec.Cmd, the defaults are inherited from the parent
process.
Options.GOPATH is gone. If the client needs to override
GOPATH, they must use Env, but typically the inherited environment
is correct.
The tests not longer use os.Chdir.
We now guarantee that Package.Srcs are absolute file names.
Added test for Options.Dir and relative patterns.
This is a copy of golang.org/cl/123777, which had a merge conflict.
Change-Id: I301724581f3d8c712ea78fa5ab5cabd909940dca
Reviewed-on: https://go-review.googlesource.com/123777
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
In the go build system, test packages and executables do not have a
name distinct from the package under test; they are implied, so
"go test fmt" means build those packages but "go build fmt" does not.
This change adds a Tests boolean option to indicate that implied
tests are desired during pattern expansion.
It has no effect on build systems that have explicit names
for tests, such as Blaze/Bazel.
The gopackages diagnostic tool now has a -test flag.
Change-Id: I424f343958c4286539e518d5f30067da19a57f3b
Reviewed-on: https://go-review.googlesource.com/123775
Reviewed-by: Michael Matloob <matloob@golang.org>
This package defines a new API for applications that need information
about Go packages, such as their source files, tests, dependencies,
and (optionally) typed syntax trees. It is intended to replace both
go/build and golang.org/x/tools/go/loader with an API that is simpler
yet supports a range of build systems including 'go build', vgo,
Bazel, and Blaze.
This CL contains the API, the "go list"-based implementation, and some
basic tests. More tests, more features as described in doc.go, and
implementations for bazel and blaze will follow.
Read doc.go for orientation and a list of open questions.
Change-Id: Ib39f15b5e4e2f854553e7185fec5cf135641ffb0
Reviewed-on: https://go-review.googlesource.com/116359
Run-TryBot: Alan Donovan <adonovan@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>