Documentation ¶
Index ¶
- Constants
- func Compile(goos, goarch, ldflags, magePath, goCmd, compileTo string, gofiles []string, ...) error
- func ExeName(goCmd, cacheDir string, files []string) (string, error)
- func GenerateMainfile(binaryName, path string, info *parse.PkgInfo) error
- func Invoke(inv Invocation) int
- func Magefiles(magePath, goos, goarch, goCmd string, stderr io.Writer, ...) ([]string, error)
- func Main() int
- func Parse(stderr, stdout io.Writer, args []string) (inv Invocation, cmd Command, err error)
- func ParseAndRun(stdout, stderr io.Writer, stdin io.Reader, args []string) int
- func RunCompiled(inv Invocation, exePath string, errlog *log.Logger) int
- type Command
- type Invocation
Constants ¶
const MagefilesDirName = "magefiles"
MagefilesDirName is the name of the default folder to look for if no directory was specified, if this folder exists it will be assumed mage package lives inside it.
Variables ¶
This section is empty.
Functions ¶
func Compile ¶
func Compile(goos, goarch, ldflags, magePath, goCmd, compileTo string, gofiles []string, isDebug bool, stderr, stdout io.Writer) error
Compile uses the go tool to compile the files into an executable at path.
func ExeName ¶
ExeName reports the executable filename that this version of Mage would create for the given magefiles.
func GenerateMainfile ¶
GenerateMainfile generates the mage mainfile at path.
func Magefiles ¶
func Magefiles(magePath, goos, goarch, goCmd string, stderr io.Writer, isMagefilesDirectory, isDebug bool) ([]string, error)
Magefiles returns the list of magefiles in dir.
func Main ¶
func Main() int
Main is the entrypoint for running mage. It exists external to mage's main function to allow it to be used from other programs, specifically so you can go run a simple file that run's mage's Main.
func Parse ¶
Parse parses the given args and returns structured data. If parse returns flag.ErrHelp, the calling process should exit with code 0.
func ParseAndRun ¶
ParseAndRun parses the command line, and then compiles and runs the mage files in the given directory with the given args (do not include the command name in the args).
func RunCompiled ¶
func RunCompiled(inv Invocation, exePath string, errlog *log.Logger) int
RunCompiled runs an already-compiled mage command with the given args,
Types ¶
type Command ¶ added in v1.14.1
type Command int
Command tracks invocations of mage that run without targets or other flags.
type Invocation ¶
type Invocation struct { Debug bool // turn on debug messages Dir string // directory to read magefiles from WorkDir string // directory where magefiles will run Force bool // forces recreation of the compiled binary Verbose bool // tells the magefile to print out log statements List bool // tells the magefile to print out a list of targets Help bool // tells the magefile to print out help for a specific target Keep bool // tells mage to keep the generated main file after compiling Timeout time.Duration // tells mage to set a timeout to running the targets CompileOut string // tells mage to compile a static binary to this path, but not execute GOOS string // sets the GOOS when producing a binary with -compileout GOARCH string // sets the GOARCH when producing a binary with -compileout Ldflags string // sets the ldflags when producing a binary with -compileout Stdout io.Writer // writer to write stdout messages to Stderr io.Writer // writer to write stderr messages to Stdin io.Reader // reader to read stdin from Args []string // args to pass to the compiled binary GoCmd string // the go binary command to run CacheDir string // the directory where we should store compiled binaries HashFast bool // don't rely on GOCACHE, just hash the magefiles }
Invocation contains the args for invoking a run of Mage.
func (Invocation) UsesMagefiles ¶ added in v1.14.1
func (i Invocation) UsesMagefiles() bool
UsesMagefiles returns true if we are getting our mage files from a magefiles directory.