pkg

package
v0.0.0-...-6f03ccd Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("pkg: Mod not found")

ErrNotFound is returned when the given package is not found.

Functions

This section is empty.

Types

type Error

type Error struct {
	Reason ErrorReason
	Mode   Mode
	Pkg    Package
	Err    error
}

Error contains details about the errors that occured while installing or uninstalling a package.

func NewError

func NewError(mode Mode, pkg Package, err error) Error

NewError with given mode and package.

func NewErrorReason

func NewErrorReason(reason ErrorReason, mode Mode, pkg Package, err error) Error

NewErrorReason with given reason, mode and package.

func (Error) Error

func (p Error) Error() string

func (Error) String

func (p Error) String() string

func (Error) Unwrap

func (p Error) Unwrap() error

Unwrap the error underneath.

type ErrorReason

type ErrorReason int

ErrorReason that is included in Error.

const (
	ReasonUnknown ErrorReason = iota
	ReasonNoInternet
	ReasonAlreadyInstalled
	ReasonInvalidFormat
	ReasonNotFound
	ReasonNotAvailable
	ReasonAccess
	ReasonDependant
)

Reasons for an installation, uninstallation or update to fail

type Info

type Info struct {
	Name           string
	NiceName       string
	Description    string
	Licence        string
	CurrentVersion string
	NewestVersion  string
	Hidden         bool
}

Info about a package.

func (Info) Outdated

func (info Info) Outdated() (bool, error)

Outdated checks if an newer version is available

type Mode

type Mode int

Mode of the installation.

const (
	ModeUnknown Mode = iota
	ModeInstall
	ModeUninstall
	ModeUpdate
)

Modes of operations

func (Mode) String

func (m Mode) String() string

type Package

type Package interface {
	Info() (Info, error)
	Installed() bool
	Available() bool

	Install() error
	Uninstall() error
	Update() error

	Dependencies() ([]Package, error)
	NewestDependencies() ([]Package, error)
}

Package represents a common set of functions all mods and tools share.

Jump to

Keyboard shortcuts

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