jessevdk / go-flags

go command line option parser
http://godoc.org/github.com/jessevdk/go-flags
BSD 3-Clause "New" or "Revised" License
2.59k stars 308 forks source link

'ErrorType' needs an 'Error' method in v1.4.0 #352

Closed plucky-groove3 closed 3 years ago

plucky-groove3 commented 3 years ago
func main() {
    if _, err := parser.Parse(); err != nil {
        switch flagsErr := err.(type) {
        case flags.ErrorType:
            if flagsErr == flags.ErrHelp {
                os.Exit(0)
            }
            os.Exit(1)
        default:
            os.Exit(1)
        }
    }
}

the example goes wrong with Release v1.4.0 , 'ErrorType' needs an 'Error' method. just like...

func (e ErrorType) Error() string {
    return e.String()
}
jessevdk commented 3 years ago

https://github.com/jessevdk/go-flags/blob/c17162fe8fd74f119ff938c5c67af63e3bac5ded/error.go#L100-L102

Will release new version, see https://github.com/jessevdk/go-flags/issues/345