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
Showing
This diff is collapsed.
Please
register
or
sign in
to comment