list

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: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSeenModule      = errors.New("this module was already scanned")
	ErrDuplicateModule = errors.New(
		"this module conflicts with another one that declares the same path",
	)
	ErrIgnoredModule       = errors.New("the user requested to ignore this module path")
	ErrUnknownOutputFormat = errors.New("unknown output format")
	ErrDuplicateProvides   = errors.New(
		"the provided module path has already been declared",
	)
)

Taking only module into account: we do not allow several versions of the same module path within a single source directory, because a source directory is associated with a single project version

Functions

func BuildRequires

func BuildRequires(
	sources []string,
	ver *version.Version,
	includeMods []string,
	ignoreMods []string,
	output string,
	outputFormat string,
) (descriptor.Requires, write.Files, string, error)

Retrieves the build dependencies for the modules and generates a report

func Descriptor

func Descriptor(
	info modfiles.ModFiles,
	ver *version.Version,
	addUnknownModules bool,
	modules map[string]bool,
	results *Results,
	onlydescr bool,
	walksubs bool,
) error

Walks a module tree, identified by its modfiles.ModFiles info

func Module

func Module(
	root string,
	ver *version.Version,
	addUnknownModules bool,
	modules map[string]bool,
	results *Results,
	onlydescr bool,
) error

Walks a module tree to list its constituent files

func PathRequires

func PathRequires(
	sources []string,
	includeMods []string,
	ignoreMods []string,
	output string,
	outputFormat string,
) (descriptor.Requires, write.Files, string, error)

Retrieves the path dependencies for the modules and generates a report

func Requires

func Requires(
	sources []string,
	includeMods []string,
	ignoreMods []string,
	output string,
	outputFormat string,
) (descriptor.Requires, write.Files, string, error)

Retrieves the runtime dependencies for the modules and generates a report

func TryModule

func TryModule(path string) (result modfiles.ModFiles, err error)

Check if a file path is a valid module descriptor; return a modfiles.ModFiles struct if true

Types

type Results

type Results struct {
	sync.RWMutex
	Modules map[string]*modfiles.ModFiles
}

func Discover

func Discover(
	sources []string,
	includeMods []string,
	ignoreMods []string,
	onlyRoot bool,
	output string,
	outputFormat string,
) (*Results, write.Files, string, error)

Discovers Go modules within the provided sources and generates a report

func Provides

func Provides(
	sources []string,
	ver *version.Version,
	includeMods, ignoreMods []string,
	onlyName, onlyVersion bool,
	output, outputFormat string,
) (*Results, write.Files, string, error)

Generates a report of the provides information for the modules

func Scan

func Scan(
	sources []string,
	ver *version.Version,
	includeMods []string,
	ignoreMods []string,
	onlydescr bool,
) (*Results, error)

Walks sources to find and read Go module source trees within

func (*Results) BuildRequires

func (modules *Results) BuildRequires() (descriptor.Requires, error)

Retrieves the build dependencies for the modules

func (*Results) CSV

func (modules *Results) CSV(onlyRoot bool) string

Lists the modules in CSV format

func (*Results) Format

func (modules *Results) Format(format string, onlyRoot bool) (string, error)

Formats the module list in the specified format

func (*Results) JSON

func (modules *Results) JSON() (string, error)

Lists the modules in JSON format

func (*Results) List

func (modules *Results) List(separator string, onlyRoot bool) string

Lists the modules in the provided format

func (*Results) Provides

func (modules *Results) Provides() (descriptor.Provides, error)

Retrieves the provides information for the modules

func (*Results) Requires

func (modules *Results) Requires() (descriptor.Requires, error)

Retrieves the runtime dependencies for the modules

func (*Results) Text

func (modules *Results) Text(onlyRoot bool) string

Lists the modules in text format

Jump to

Keyboard shortcuts

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