gomod

package
v0.0.0-...-703489d Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DependencyErr = &Error{}

DependencyErr is a Dependency Error instance. For use with with error.Is.

View Source
var (
	// ErrNoDomain is returned when no domain is provided.
	ErrNoDomain = errors.New("no domain provided")
)

Functions

func Check

func Check(gomod, release, moduleRelease string, selector Matcher, ruleset git.RulesetType, out io.Writer) error

Check examines a go mod file for dependencies and determines if each have a release artifact based on the ruleset provided. Check leverages the same rules used by knative.dev/toolbox/pkg/git.Repo().BestRefFor

func Float

func Float(gomod, release, moduleRelease string, selector Matcher, ruleset git.RulesetType) ([]string, error)

Float examines a go mod file for dependencies and then discovers the best go mod refs to use for a given release based on the provided ruleset. Returns the set of module refs that were found. If no ref is found for a dependency, Float omits that ref from the returned list. Float leverages the same rules used by knative.dev/toolbox/pkg/git.Repo().BestRefFor

func Module

func Module(gomod string, selector Matcher) (string, []string, error)

Module returns the name and a list of direct dependencies for a given module. TODO: support url and gopath at some point for the gomod string.

func Modules

func Modules(gomod []string, selector Matcher) (map[string][]string, []string, error)

Modules returns a map of given given modules to their direct dependencies, and a list of unique dependencies.

Types

type Error

type Error struct {
	Module       string
	Dependencies []string
}

Error holds the result of a failed check.

func (*Error) Error

func (e *Error) Error() string

Error implements error.Error()

func (*Error) Is

func (e *Error) Is(target error) bool

Is implements error.Is(target)

type Matcher

type Matcher func(modname string) bool

Matcher matches a module name.

func CurrentModulesMatcher

func CurrentModulesMatcher() (Matcher, error)

CurrentModulesMatcher matches the current project modules.

func DefaultSelector

func DefaultSelector(domain string) (Matcher, error)

DefaultSelector returns a selector that includes modules with given domain, but excludes the current project modules.

type ReleaseMeta

type ReleaseMeta struct {
	Module              string
	ReleaseBranchExists bool
	ReleaseBranch       string
	Release             string
}

ReleaseMeta holds metadata important to module release status.

func ReleaseStatus

func ReleaseStatus(gomod, release, moduleRelease string, out io.Writer) (*ReleaseMeta, error)

ReleaseStatus collects metadata about release branch status and next released version tags for a given module.

Jump to

Keyboard shortcuts

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