Skip to content

Instantly share code, notes, and snippets.

@chirino
Created June 13, 2019 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chirino/c095ac4696130750408f17d7bf4cb35c to your computer and use it in GitHub Desktop.
Save chirino/c095ac4696130750408f17d7bf4cb35c to your computer and use it in GitHub Desktop.
var mysh = sh.New().
CommandLog(os.Stdout).
CommandLogPrefix("> ").
Env(map[string]string{
"CGO_ENABLED": "0",
"GOOS": "linux",
"GOARCH": "amd64",
}).
Dir("./target")
func run(line string) {
// functions on mysh return new immutable objects,
// so we can reuse it without fear.
mysh.Line(line).MustExec()
}
func BuildExecutable() {
// Note: "my app" will be a single argument to the go command
run(`go build -o "my app" github.com/chirino/cmd/myapp`)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment