run

package
v0.8.1-0...-37858a3 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package run provides a task for the Go toolchain "run" command. It requires at least Go version 1.17 which comes with support to run commands in module-aware mode, by passing version suffixes to `go run` arguments, without affecting the `main` module and will not "pollute" the `go.mod` file. See the documentation about how to compile and run Go programs for more details.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Options)

Option is a task option.

func WithArgs

func WithArgs(args ...string) Option

WithArgs sets additional arguments to pass to the command.

func WithEnv

func WithEnv(env map[string]string) Option

WithEnv sets the task specific environment.

func WithModulePath

func WithModulePath(path string) Option

WithModulePath sets the module import path.

func WithModuleVersion

func WithModuleVersion(version *semver.Version) Option

WithModuleVersion sets the module version.

type Options

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

Options are task options.

func NewOptions

func NewOptions(opts ...Option) *Options

NewOptions creates new task options.

type Task

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

Task is a task for the Go toolchain "run" command. It requires at least Go version 1.17 which comes with support to run commands in module-aware mode, by passing version suffixes to `go run` arguments, without affecting the `main` module and will not "pollute" the `go.mod` file anymore. See the documentation about how to compile and run Go programs for more details.

func New

func New(opts ...Option) *Task

New creates a new task for the Go toolchain "run" command.

func (*Task) BuildParams

func (t *Task) BuildParams() []string

BuildParams builds the parameters. Note that configured flags are applied after the "GOFLAGS" environment variable and could overwrite already defined flags.

See the Go command documentation about environment variables and the builtin helps for more details:

go help environment
go help env

func (*Task) Env

func (t *Task) Env() map[string]string

Env returns the task specific environment.

func (*Task) Kind

func (t *Task) Kind() task.Kind

Kind returns the task kind.

func (*Task) Name

func (t *Task) Name() string

Name returns the task name.

func (*Task) Options

func (t *Task) Options() task.Options

Options returns the task options.

Jump to

Keyboard shortcuts

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