dependency

package
v1.77.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: Apache-2.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 AnyOfGroup

type AnyOfGroup struct {
	Name    string
	Members map[string]*semver.Constraints
}

AnyOfGroup is an alternative-dependency group: at least one member must be installed and satisfy its constraint for the group to pass. A nil constraint on a member means "any installed version of this alternative is acceptable".

type AnyOfRule

type AnyOfRule struct {
	// contains filtered or unexported fields
}

AnyOfRule evaluates one or more AnyOf groups against the current dependency graph. Each group is satisfied independently — for the package to pass, every group must have ≥1 installed member that meets its constraint. It is a gate: it returns Undefined or Forbid only.

AnyOf groups add no edges to the topological graph, so fallback chains across packages (A any-of {B, C}; B any-of {A, D}) do not produce cycles.

func NewAnyOfRule

func NewAnyOfRule(getter Getter, groups []AnyOfGroup) *AnyOfRule

NewAnyOfRule constructs an AnyOfRule that resolves member versions through the given Getter (shared with the regular dependency.Rule).

func (*AnyOfRule) Decide

func (r *AnyOfRule) Decide() rule.Decision

Decide returns Undefined when every group has ≥1 installed member that satisfies its constraint. The first failing group short-circuits to Forbid; the Reason is AnyOfDependenciesUnmet and the Message names the group plus its members in sorted order so identical inputs produce identical messages across reconciles.

type Dependency

type Dependency struct {
	Constraint *semver.Constraints
	// if node not present, just skip check
	Optional bool
}

Dependency describes a requirement on another module's installed version.

type Getter

type Getter func(module string) *semver.Version

Getter returns the installed version of a module, or nil when it is absent.

type NoneOfGroup

type NoneOfGroup struct {
	Name    string
	Members map[string]*semver.Constraints
}

NoneOfGroup is a group of forbidden dependencies: no member may be installed in a way that matches its constraint. A nil constraint on a member forbids the module at any installed version; a non-nil constraint narrows the forbidden range, so versions outside the constraint remain acceptable.

type NoneOfRule

type NoneOfRule struct {
	// contains filtered or unexported fields
}

NoneOfRule evaluates one or more NoneOf groups against the current dependency graph. Each group is violated independently — for the package to pass, every group must have zero installed members that match their constraints. It is a gate: it returns Undefined or Forbid only. NoneOf groups add no edges to the topological graph; "must not be installed" expresses an admission predicate, not an ordering relation.

func NewNoneOfRule

func NewNoneOfRule(getter Getter, groups []NoneOfGroup) *NoneOfRule

NewNoneOfRule constructs a NoneOfRule that resolves member versions through the given Getter (shared with the regular dependency.Rule and the AnyOfRule).

func (*NoneOfRule) Decide

func (r *NoneOfRule) Decide() rule.Decision

Decide returns Undefined when every group has zero violators. The first violated group short-circuits to Forbid; the Reason is NoneOfDependenciesViolated and the Message names the group plus its actual offending members in sorted order so identical inputs produce identical messages across reconciles.

type Rule

type Rule struct {
	// contains filtered or unexported fields
}

Rule is a gate that vetoes a package whose declared dependencies are absent or installed at an incompatible version. It only ever returns Undefined or Forbid — it never turns a package on.

func NewRule

func NewRule(getter Getter, dependencies map[string]Dependency) *Rule

NewRule constructs a dependency rule resolving versions through the getter.

func (*Rule) Decide

func (r *Rule) Decide() rule.Decision

Decide vetoes (Forbid) on the first dependency that is missing (and not optional) or violates its constraint; otherwise it returns Undefined.

Jump to

Keyboard shortcuts

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