Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Package ¶
type Package struct { *build.Package ImportVendoredPaths map[string]string // Package dep import path to real vendored import path }
Package wraps a Go build.Package and adds additional data about how paths used to import vendored dependencies.
func (*Package) AllImports ¶
AllImports returns a list of all package import paths imported by the current package. If vendored is true, the import paths returned will be the actual paths the Go build tool resolves.
type PackageGraph ¶
type PackageGraph struct {
Packages map[string]*Package // Packages, keyed by the vendored import path
}
PackageGraph represents all Go packages reachable from a single package.
func DefaultRecursiveImport ¶
func DefaultRecursiveImport(importPath string) (*PackageGraph, error)
DefaultRecursiveImport imports a Go package and all of its reachable dependencies. The environment's GOPATH and default build context are used.
func RecursiveImport ¶
func RecursiveImport(importPath string, goPath string, buildContext *build.Context) (*PackageGraph, error)
RecursiveImport imports a Go package and all of its reachable dependencies.
func (*PackageGraph) GoPackages ¶
func (p *PackageGraph) GoPackages() []*build.Package
GoPackages returns all build.Packages in the graph.
func (*PackageGraph) ShortestPath ¶
func (p *PackageGraph) ShortestPath(from, to string) (Path, error)
ShortestPath returns the shortest import path from one package to another. If there is no path between the packages then nil is returned. If there are multiple equally short paths, the path chosen to return is not deterministic. If either the from or to package does not exist, an error is returned.
func (*PackageGraph) ToMap ¶
func (p *PackageGraph) ToMap() map[string][]string
ToMap returns a map of package names to the package names of all dependencies. The dependencies are vendored import paths.