Documentation
¶
Overview ¶
Package manifests recognizes the files in a tree that declare or pin dependencies, and accounts for the ones a dependency scan did not read.
One list for every reader: a scanner deciding whether resolving nothing was a real answer, a scan reporting what it left unread, and `draugr init` deciding what a tree needs. Kept apart they disagree about what counts as a manifest, and each disagreement is a file one of them is silent about.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatOf ¶ added in v0.135.0
FormatOf names the format a path is, as Formats lists it, or "" for a path no rule recognizes. A member of a family named by one entry, requirements-dev.txt or pylock.dev.toml, is that entry. Content is not read, so a file that declares nothing still has a format.
func IsLockfile ¶ added in v0.147.0
IsLockfile reports whether a path is a lockfile, by the format FormatOf names for it.
Types ¶
type File ¶
type File struct {
// Path is slash-separated and relative to the root that was searched.
Path string
Ecosystem string
Kind Kind
}
File is one dependency file found in a tree.
type Format ¶ added in v0.135.0
type Format struct {
// Name is the file's base name, or `*` and a suffix for a family such as `*.csproj`.
Name string
Ecosystem string
Kind Kind
}
Format is one name of dependency file Draugr recognizes.
type Kind ¶
type Kind int
Kind separates a file that names dependencies from one that pins them.
const ( // Pinned lists exact versions, and a scanner reads packages from it directly: a lockfile, // requirements.txt, go.mod, pom.xml. Pinned Kind = iota // Declared names dependencies without resolving them, so a scanner needs the lockfile beside // it: package.json, pyproject.toml, Cargo.toml, a .csproj. Declared )
type Reason ¶
type Reason string
Reason is why a dependency file contributed no packages to a scan.
const ( // NoLockfile is a declared manifest with no lockfile beside it or above it. NoLockfile Reason = "no lockfile" // Unpinned is a requirements file whose entries name no exact version. Unpinned Reason = "no pinned versions" // NotRead is a file the scan read no packages from: a name its scanner does not read, or a // format it does not support. NotRead Reason = "no packages read" )
type Unread ¶
Unread is a dependency file a scan did not read, and why.
func Account ¶
Account returns the dependency files under root that are not in read, each with the reason it contributed nothing.
read holds slash-separated paths relative to root, as a scanner names the files it took packages from. A declared manifest resolved by a lockfile is not unread: the lockfile is what a scanner reads for it, and reporting both would warn about every project that is set up correctly.
A lockfile resolves its manifest when the walk holds it, so that it is reported itself if no scanner reads it, or when the walk left it out as the format with nothing in it. A file merely named like a lockfile does neither, because resolving on the name alone would leave the manifest and the lockfile both unreported with nothing read from either.