Documentation
¶
Overview ¶
Package toolchain builds a resolve.Graph by running an ecosystem's own tools on a manifest, such as the go command on go.mod or mvn on pom.xml, for projects whose lockfile does not record the whole graph.
It runs build tooling on files the scanned repository controls, and some tools run the repository's own code, such as build scripts and plugins, so callers run it inside an isolated sandbox. It never needs credentials: the caller points the tools at a registry or mirror through Options.Env. Each tool run has a timeout, and Limits bounds what is read from it.
A tool that is missing, fails, times out or prints too much makes its root unknown; one that cannot reach the registry makes it partial, with what the tool resolved without it. Resolve never fails because of a tool. A root's Manifest and Lockfile are both the manifest's path, since the tool, not a lockfile, resolved it. A Maven reactor has one root per module, each with the module's pom.xml as both.
A go.work is ignored (GOWORK=off): each go.mod resolves on its own, and the workspace's other modules are not local nodes. They appear as the versions go.mod requires, or as local nodes only through a directory replace.
Index ¶
Constants ¶
const DefaultTimeout = 10 * time.Minute
DefaultTimeout bounds each tool run when Options.Timeout is zero.
Variables ¶
var ErrUnsupported = errors.New("unsupported manifest")
ErrUnsupported is returned for a manifest whose base name has no tool.
Functions ¶
Types ¶
type Limits ¶
type Limits struct {
MaxOutput int64 // stdout or stderr of one tool run, or a file it writes; more makes the root unknown (too_large)
MaxNodes int // nodes kept; reaching it makes the roots partial (node_limit)
MaxEdges int // edges kept; reaching it makes the roots partial (edge_limit)
}
Limits bounds the output read from a tool and the graph built from it. A Maven reactor's modules are resolved apart, so MaxNodes and MaxEdges bound each module's graph, not the merged one.
func DefaultLimits ¶
func DefaultLimits() Limits
DefaultLimits returns limits that fit any real project: 64 MiB of output, 50,000 nodes and 500,000 edges.
type Options ¶
type Options struct {
Timeout time.Duration // per tool run; zero means DefaultTimeout
// Env is added to the process environment after each tool's defaults, so
// its values win. It is where the caller sets the registry or mirror,
// such as GOPROXY, and may override a default, such as GOFLAGS.
Env []string
Limits Limits // zero means DefaultLimits
}
Options configures Resolve.