Documentation ¶
Overview ¶
Package make provides the go-make command implementation.
Index ¶
- Constants
- Variables
- func AbsPath(dir string) string
- func CmdGitTop() []string
- func CmdGoInstall(path, version string) []string
- func CmdMakeTargets(file string, args ...string) []string
- func CmdTestDir(path string) []string
- func GetEnvDefault(key, value string) string
- func GoMakePath(path, version string) string
- func Make(stdin io.Reader, stdout, stderr io.Writer, info *info.Info, config, wd string, ...) int
- func NewErrCallFailed(path string, args []string, err error) error
- func NewErrNotFound(path, version string, err error) error
- type GoMake
Constants ¶
const ( // EnvGoMakeConfig provides the name of the go-make config environment // variable. EnvGoMakeConfig = "GOMAKE_CONFIG" // EnvGoPath provides the name of the genera go path environment variable. EnvGoPath = "GOPATH" // Makefile provides the name of the base makefile to be executed by // go-make. Makefile = "Makefile.base" // bashCompletion provides the bash completion script for go-make. BashCompletion = "### bash completion for go-make\n" + "function __complete_go-make() {\n" + " COMPREPLY=($(compgen -W \"$(go-make show-targets 2>/dev/null)\" \\\n" + " -- \"${COMP_WORDS[COMP_CWORD]}\"));\n" + "}\n" + "complete -F __complete_go-make go-make;\n" ZshCompletion = "### zsh completion for go-make\n" + "zstyle ':completion:*:*:make:*' tag-order 'targets'\n" + "function __complete_go-make() {\n" + " COMPREPLY=($(compgen -W \"$(go-make show-targets 2>/dev/null)\" \\\n" + " -- \"${COMP_WORDS[COMP_CWORD]}\"));\n" + "}\n" + "complete -F __complete_go-make go-make;\n" )
const ( ExitSuccess int = 0 ExitConfigFailure int = 2 ExitTargetFailure int = 3 )
Available exit code constants.
Variables ¶
var CmdArgRegex = regexp.MustCompile(
`^(call|show|git-|test-|lint|run-|version-|update).*$`)
CmdArgRegex is the regular expression that match commands with arguments that will be transformed into a `ARGS` variable.
var ErrNotFound = errors.New("version not found")
ErrNotFound represent a version not found error.
Functions ¶
func CmdGitTop ¶ added in v0.0.47
func CmdGitTop() []string
CmdGitTop creates the argument array of a `git rev-parse` command to get the root path of the current git repository.
func CmdGoInstall ¶ added in v0.0.26
CmdGoInstall creates the argument array of a `go install <path>@<version>` command.
func CmdMakeTargets ¶
CmdMakeTargets creates the argument array of a `make --file <Makefile> <targets...>` command using the given makefile name amd argument list.
func CmdTestDir ¶ added in v0.0.26
CmdTestDir creates the argument array of a `test -d <path>` command. We use this to test if a directory exists, since it allows us to mock the check.
func GetEnvDefault ¶ added in v0.0.29
GetEnvDefault returns the value of the environment variable with given key or the given default value, if the environment variable is not set.
func GoMakePath ¶ added in v0.0.26
GoMakePath returns the path to the go-make config directory.
func Make ¶
func Make( stdin io.Reader, stdout, stderr io.Writer, info *info.Info, config, wd string, env []string, args ...string, ) int
Make runs the go-make command with given build information, standard output writer, standard error writer, and command arguments.
func NewErrCallFailed ¶
NewErrCallFailed wraps the error of a failed command call.
func NewErrNotFound ¶
NewErrNotFound wraps the error of failed command to install the requested go-mock config version.
Types ¶
type GoMake ¶
type GoMake struct { // Info provides the build information of go-make. Info *info.Info // Executor provides the command executor. Executor cmd.Executor // Logger provides the logger. Logger log.Logger // Stdin provides the standard input reader. Stdin io.Reader // Stdout provides the standard output writer. Stdout io.Writer // Stderr provides the standard error writer. Stderr io.Writer // Config provides the go-make config argument. Config string // Env provides the additional environment variables. Env []string // The actual working directory. WorkDir string // The version of the go-make config. ConfigVersion string // The directory of the go-make config. ConfigDir string // The path to the go-make config Makefile. Makefile string // Trace provides the flags to trace calls. Trace bool }
GoMake provides the default `go-make` application context.
func NewGoMake ¶
func NewGoMake( stdin io.Reader, stdout, stderr io.Writer, info *info.Info, config, wd string, env ...string, ) *GoMake
NewGoMake returns a new default `go-make` service context with given standard input reader, standard output writer, standard error writer, build information, config setup, working directory and environment variables.