Skip to content

Instantly share code, notes, and snippets.

@mattfarina
Created November 20, 2015 14:20
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 mattfarina/994acd1e1e8dd20d662f to your computer and use it in GitHub Desktop.
Save mattfarina/994acd1e1e8dd20d662f to your computer and use it in GitHub Desktop.
package main
import (
"errors"
"github.com/codegangsta/cli"
)
var e error
func main() {
app := cli.NewApp()
app.Name = "boom"
app.Usage = "make an explosive entrance"
app.Action = func(c *cli.Context) {
println("boom! I say!")
e = errors.New("I brokes it")
return
}
app.After = func(c *cli.Context) error {
return e
}
app.RunAndExitOnError()
}
$ go run main.go
boom! I say!
I brokes it
exit status 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment