modutils

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultExecutor is the default executor.
	DefaultExecutor = &Executor{}

	// ListE is an alias to DefaultExecutor.ListE.
	ListE = DefaultExecutor.ListE
	// List is an alias to DefaultExecutor.List.
	List = DefaultExecutor.List

	// GetE is an alias to DefaultExecutor.GetE.
	GetE = DefaultExecutor.GetE
	// Get is an alias to DefaultExecutor.Get.
	Get = DefaultExecutor.Get

	// DirE is an alias to DefaultExecutor.DirE.
	DirE = DefaultExecutor.DirE
	// Dir is an alias to DefaultExecutor.Dir.
	Dir = DefaultExecutor.Dir

	// BuildE is an alias to DefaultExecutor.BuildE.
	BuildE = DefaultExecutor.BuildE
	// Build is an alias to DefaultExecutor.Build.
	Build = DefaultExecutor.Build
)

Functions

This section is empty.

Types

type Executor

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

Executor is an executor for go.mod-related operations.

func NewExecutor

func NewExecutor(opts ExecutorOptions) *Executor

NewExecutor creates a new Executor with the given ExecutorOptions.

func (*Executor) Build

func (e *Executor) Build(filename, name string, parts ...string)

Build builds the specified module to the target filename, optionally taking sub-paths in the target module. It panics if an error occurs.

func (*Executor) BuildE

func (e *Executor) BuildE(filename, name string, parts ...string) error

BuildE builds the specified module to the target filename, optionally taking sub-paths in the target module.

func (*Executor) Dir

func (e *Executor) Dir(name string, parts ...string) string

Dir gets the on-disk location of the specified module, optionally joining the parts to the directory. It panics if an error occurs.

func (*Executor) DirE

func (e *Executor) DirE(name string, parts ...string) (string, error)

DirE gets the on-disk location of the specified module, optionally joining the parts to the directory.

func (*Executor) Get

func (e *Executor) Get(name string) *Module

Get gets the module with the specified name. It panics if an error occurs.

func (*Executor) GetE

func (e *Executor) GetE(name string) (*Module, error)

GetE gets the module with the specified name.

func (*Executor) List

func (e *Executor) List() []Module

List lists all modules of the current module. It panics if an error occurs.

func (*Executor) ListE

func (e *Executor) ListE() ([]Module, error)

ListE lists all modules of the current module.

type ExecutorOptions

type ExecutorOptions struct {
	// Dir is the working directory the executor runs in.
	Dir string
}

ExecutorOptions are options to create an executor with.

type Module

type Module struct {
	Path      string
	Version   string
	Replace   *Module
	Time      time.Time
	Indirect  bool
	Main      bool
	Dir       string
	GoMod     string
	GoVersion string
}

Module is a module read from a go.mod file and its dependencies.

Jump to

Keyboard shortcuts

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