importer

package
v0.0.0-...-96d7121 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2018 License: LGPL-3.0 Imports: 5 Imported by: 0

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

func (p *Package) AllImports(vendored bool) []string

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.

type Path

type Path []string

Path is an immutable path from one Go Package. A path of [A B C] represents: "A imports package B and B imports package C".

func (Path) Append

func (p Path) Append(part string) Path

Append creates a new Path with the part appended to it. [A B].Append(C) returns [A B C].

Directories

Path Synopsis
test_packages
a
b

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL