]> Cypherpunks repositories - gostls13.git/commit
go/build: replace FindTree, ScanDir, Tree, DirInfo with Import, Package
authorRuss Cox <rsc@golang.org>
Thu, 1 Mar 2012 17:12:09 +0000 (12:12 -0500)
committerRuss Cox <rsc@golang.org>
Thu, 1 Mar 2012 17:12:09 +0000 (12:12 -0500)
commitebe1664d2789cd4ea0ded0eccb9067c729378cc5
tree95f94bacee98abc860d9510c097d8b2a590def91
parenta72b87efa934957245449975a940763f49026a7c
go/build: replace FindTree, ScanDir, Tree, DirInfo with Import, Package

This is an API change, but one I have been promising would
happen when it was clear what the go command needed.

This is basically a complete replacement of what used to be here.

build.Tree is gone.

build.DirInfo is expanded and now called build.Package.

build.FindTree is now build.Import(package, srcDir, build.FindOnly).
The returned *Package contains information that FindTree returned,
but applicable only to a single package.

build.ScanDir is now build.ImportDir.

build.FindTree+build.ScanDir is now build.Import.

The new Import API allows specifying the source directory,
in order to resolve local imports (import "./foo") and also allows
scanning of packages outside of $GOPATH.  They will come back
with less information in the Package, but they will still work.

The old go/build API exposed both too much and too little.
This API is much closer to what the go command needs,
and it works well enough in the other places where it is
used.  Path is gone, so it can no longer be misused.  (Fixes issue 2749.)

This CL updates clients of go/build other than the go command.
The go command changes are in a separate CL, to be submitted
at the same time.

R=golang-dev, r, alex.brainman, adg
CC=golang-dev
https://golang.org/cl/5713043
24 files changed:
src/cmd/api/goapi.go
src/cmd/api/goapi_test.go
src/cmd/godoc/godoc.go
src/cmd/godoc/main.go
src/pkg/exp/types/gcimporter.go
src/pkg/go/build/build.go
src/pkg/go/build/build_test.go
src/pkg/go/build/cgotest/cgotest.c [deleted file]
src/pkg/go/build/cgotest/cgotest.go [deleted file]
src/pkg/go/build/cgotest/cgotest.h [deleted file]
src/pkg/go/build/cmdtest/main.go [deleted file]
src/pkg/go/build/path.go [deleted file]
src/pkg/go/build/pkgtest/pkgtest.go [deleted file]
src/pkg/go/build/pkgtest/sqrt_386.s [deleted file]
src/pkg/go/build/pkgtest/sqrt_386_test.go [deleted file]
src/pkg/go/build/pkgtest/sqrt_amd64.s [deleted file]
src/pkg/go/build/pkgtest/sqrt_amd64_test.go [deleted file]
src/pkg/go/build/pkgtest/sqrt_arm.s [deleted file]
src/pkg/go/build/pkgtest/sqrt_arm_test.go [deleted file]
src/pkg/go/build/pkgtest/sqrt_test.go [deleted file]
src/pkg/go/build/pkgtest/xsqrt_test.go [deleted file]
src/pkg/go/build/syslist_test.go
src/pkg/go/build/testdata/other/file/file.go [new file with mode: 0644]
src/pkg/go/build/testdata/other/main.go [new file with mode: 0644]