Documentation
¶
Overview ¶
Package task provides tasks and runner for Mage.
Index ¶
Constants ¶
View Source
const ( // ErrIncompatibleRunner indicates that a command runner is not compatible for a task. ErrIncompatibleRunner = wErr.ErrString("incompatible command runner") // ErrInvalidRunnerOpts indicates invalid command runner options. ErrInvalidRunnerOpts = wErr.ErrString("invalid options") // ErrInvalidTaskOpts indicates invalid task options. ErrInvalidTaskOpts = wErr.ErrString("invalid options") // ErrRun indicates that a runner failed to run. ErrRun = wErr.ErrString("failed to run") // ErrRunnerValidation indicates that a command runner validation failed. ErrRunnerValidation = wErr.ErrString("validation failed") // ErrTaskValidation indicates that a task validation failed. ErrTaskValidation = wErr.ErrString("validation failed") // ErrUnsupportedTaskKind indicates that a task kind is not supported. ErrUnsupportedTaskKind = wErr.ErrString("unsupported task kind") // ErrUnsupportedTaskOptions indicates that the task options are not supported. ErrUnsupportedTaskOptions = wErr.ErrString("unsupported task kind") )
View Source
const ( // KindNameBase is the kind name for base tasks. KindNameBase = "base" // KindNameExec is the kind name for executable file tasks. KindNameExec = "executable" // KindNameGoModule is the kind name for Go module tasks. KindNameGoModule = "go.module" // KindNameUnknown is the name for a unknown task kind. KindNameUnknown = "unknown" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrRunner ¶
type ErrRunner struct { // Err is a wrapped error. Err error // Kind is the error kind. Kind error }
ErrRunner represents a runner error.
type ErrTask ¶
ErrTask represents a task error.
type Exec ¶
type Exec interface { Task // BuildParams builds the parameters for a command runner. // Parameters consist of options, flags and arguments. // The separation of parameters from commands enables a flexible usage, e.g. when parameters can be reused for // different tasks. // // References // // (1) https://en.wikipedia.org/wiki/Command-line_interface#Anatomy_of_a_shell_CLI BuildParams() []string // Env returns the task specific environment. Env() map[string]string }
Exec is a task for a executable command.
type GoModule ¶
type GoModule interface { Exec // ID returns the identifier of a Go module. ID() *project.GoModuleID }
GoModule is a task for a Go module command.
See https://golang.org/ref/mod for more details about Go modules.
type Kind ¶
type Kind uint32
Kind defines the kind of tasks.
func (Kind) MarshalText ¶
MarshalText returns the textual representation of itself.
func (*Kind) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler to unmarshal a textual representation of itself.
type Mixin ¶
type Mixin interface { // Apply applies the mixin to task options. Apply(Options) (Options, error) }
Mixin allows to compose functions that process task options.
type Runner ¶
type Runner interface { // Handles returns the supported task kind. Handles() Kind // Run runs a command. Run(Task) error // RunOut runs a command and returns its output. RunOut(Task) (string, error) // Validate validates the runner. Validate() error }
Runner runs a command with parameters in a specific environment.
type RunnerExec ¶
type RunnerExec interface { Runner // FilePath returns the path to the (binary) command executable. FilePath() string }
RunnerExec is a runner for a (binary) command executable.
Directories
¶
Path | Synopsis |
---|---|
fs
|
|
clean
Package clean provides a task to remove filesystem paths, e.g.
|
Package clean provides a task to remove filesystem paths, e.g. |
Package gofumpt provides a task for the "mvdan.cc/gofumpt" Go module command.
|
Package gofumpt provides a task for the "mvdan.cc/gofumpt" Go module command. |
Package goimports provides a task for the "golang.org/x/tools/cmd/goimports" Go module command.
|
Package goimports provides a task for the "golang.org/x/tools/cmd/goimports" Go module command. |
Package golang provides Go toolchain tasks and runner.
|
Package golang provides Go toolchain tasks and runner. |
build
Package build provides a task for the Go toolchain "build" command.
|
Package build provides a task for the Go toolchain "build" command. |
env
Package env provides a task for the Go toolchain `env` command.
|
Package env provides a task for the Go toolchain `env` command. |
install
Package install provides a task for the Go toolchain "install" command.
|
Package install provides a task for the Go toolchain "install" command. |
test
Package test provides a task for the Go toolchain "test" command.
|
Package test provides a task for the Go toolchain "test" command. |
Package golangcilint provides a task for the "github.com/golangci/golangci-lint/cmd/golangci-lint" Go module command.
|
Package golangcilint provides a task for the "github.com/golangci/golangci-lint/cmd/golangci-lint" Go module command. |
Package gomodupgrade provides a task for the "github.com/oligot/go-mod-upgrade" Go module command.
|
Package gomodupgrade provides a task for the "github.com/oligot/go-mod-upgrade" Go module command. |
Package gotool provides a runner to install and run compiled executables of Go module-based "main" packages.
|
Package gotool provides a runner to install and run compiled executables of Go module-based "main" packages. |
Package gox provides a task for the github.com/mitchellh/gox Go module command.
|
Package gox provides a task for the github.com/mitchellh/gox Go module command. |
Click to show internal directories.
Click to hide internal directories.