For the example provided to work
Does not work :(
go run main.gopackage main
import (
"os"
"github.com/codegangsta/cli"
)
func main() {
app := cli.NewApp()
app.Flags = []cli.Flag{
cli.BoolTFlag{
Name: "ginger-crouton",
Usage: "is it in the soup?",
},
}
app.Action = func(ctx *cli.Context) error {
if !ctx.Bool("ginger-crouton") {
return cli.NewExitError("it is not in the soup", 86)
}
return nil
}
app.Run(os.Args)
}
Errors:
$ go run main.go
# command-line-arguments
./main.go:19: undefined: cli.NewExitError
./main.go:22: cannot use func literal (type func(*cli.Context) error) as type func(*cli.Context) in assignment
@FrenchBen This looks to me like an (unexpectedly) older version of cli is being used by your go run command. Can you verify that you don't have any older versions available in your $GOPATH?
you got that right... damn go get -u fixed it.
Thanks
Most helpful comment
you got that right... damn
go get -ufixed it.Thanks