manifests

package
v0.154.2 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func FormatOf(rel string) string

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

func IsLockfile(rel string) bool

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.

func Find

func Find(root string) []File

Find returns the dependency files under root, in path order. A file whose content names no dependency is left out.

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.

func Formats added in v0.135.0

func Formats() []Format

Formats lists every name of dependency file the rules recognize, in rule order.

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

type Unread struct {
	Path   string
	Reason Reason
}

Unread is a dependency file a scan did not read, and why.

func Account

func Account(root string, read map[string]bool) []Unread

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.

Jump to

Keyboard shortcuts

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