descriptor

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoDescriptor      = errors.New("no readable module descriptor")
	ErrBadDescriptor     = errors.New("no parseable module descriptor")
	ErrBadExt            = errors.New("bad file extension")
	ErrDuplicateRequires = errors.New(
		"the required module path has already been declared",
	)
	ErrUnknownOutputFormat = errors.New("unknown output format")
)

Functions

This section is empty.

Types

type Descriptor

type Descriptor struct {
	*modfile.File
}

func New

func New(path string) (*Descriptor, error)

New parses a Go .mod module descriptor without using the “go mod” command

func (*Descriptor) AnyRequires

func (descriptor *Descriptor) AnyRequires(build bool) (Requires, error)

AnyRequires returns the requires associated with a module descriptor

func (*Descriptor) BuildRequires

func (descriptor *Descriptor) BuildRequires() (Requires, error)

BuildRequires returns the build requirements associated with a module descriptor

func (*Descriptor) Path

func (descriptor *Descriptor) Path() string

Path returns the module path

func (*Descriptor) Provides

func (descriptor *Descriptor) Provides(
	path string,
	ver *version.Version,
) (Provides, error)

Provides returns the provides associated with a module descriptor

func (*Descriptor) Requires

func (descriptor *Descriptor) Requires() (Requires, error)

Requires returns the runtime requirements associated with a module descriptor

func (*Descriptor) Trim

func (descriptor *Descriptor) Trim() error

Trim removes module directives that make no sense in a clean system component environment

type Provides

type Provides map[string]*version.Version

Provides maps module paths to versions

func (Provides) Format

func (provides Provides) Format(
	format string,
	onlyName bool,
	onlyVersion bool,
	namespace string,
) (string, error)

Format formats the Provides map based on the specified format

func (Provides) Go

func (provides Provides) Go(onlyName bool, onlyVersion bool) string

Go formats the Provides map in Go format

func (Provides) RPM

func (provides Provides) RPM(onlyName bool, onlyVersion bool, namespace string) string

RPM formats the Provides map in RPM format

type Requires

type Requires map[string]*VersionRange

Requires maps module paths to version ranges

func (Requires) Format

func (requires Requires) Format(format string, namespace string) (string, error)

Format formats the Requires map based on the specified format

func (Requires) Go

func (requires Requires) Go() string

Go formats the Requires map in Go format

func (Requires) RPM

func (requires Requires) RPM(namespace string) string

RPM formats the Requires map in RPM format

type VersionRange

type VersionRange struct {
	Floor    *version.Version   `json:",omitempty"`
	Excludes []*version.Version `json:",omitempty"`
}

VersionRange represents a version range with floor and excludes

func (*VersionRange) Clean

func (vr *VersionRange) Clean()

Clean cleans the VersionRange by sorting and deduplicating the excludes

Jump to

Keyboard shortcuts

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