mirror of
https://github.com/vbatts/go-mtree.git
synced 2025-07-20 13:30:28 +00:00
go: updating modules
It seems this may be the last update to urfave/cli for go1.17, as their v2.25 uses generics of go1.18 and didn't partition it with build tags 😵😵😵 Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
c6a7295705
commit
45591ed121
40 changed files with 2475 additions and 731 deletions
23
vendor/github.com/urfave/cli/v2/errors.go
generated
vendored
23
vendor/github.com/urfave/cli/v2/errors.go
generated
vendored
|
@ -83,7 +83,7 @@ type ExitCoder interface {
|
|||
|
||||
type exitError struct {
|
||||
exitCode int
|
||||
message interface{}
|
||||
err error
|
||||
}
|
||||
|
||||
// NewExitError calls Exit to create a new ExitCoder.
|
||||
|
@ -98,23 +98,38 @@ func NewExitError(message interface{}, exitCode int) ExitCoder {
|
|||
//
|
||||
// This is the simplest way to trigger a non-zero exit code for an App without
|
||||
// having to call os.Exit manually. During testing, this behavior can be avoided
|
||||
// by overiding the ExitErrHandler function on an App or the package-global
|
||||
// by overriding the ExitErrHandler function on an App or the package-global
|
||||
// OsExiter function.
|
||||
func Exit(message interface{}, exitCode int) ExitCoder {
|
||||
var err error
|
||||
|
||||
switch e := message.(type) {
|
||||
case ErrorFormatter:
|
||||
err = fmt.Errorf("%+v", message)
|
||||
case error:
|
||||
err = e
|
||||
default:
|
||||
err = fmt.Errorf("%+v", message)
|
||||
}
|
||||
|
||||
return &exitError{
|
||||
message: message,
|
||||
err: err,
|
||||
exitCode: exitCode,
|
||||
}
|
||||
}
|
||||
|
||||
func (ee *exitError) Error() string {
|
||||
return fmt.Sprintf("%v", ee.message)
|
||||
return ee.err.Error()
|
||||
}
|
||||
|
||||
func (ee *exitError) ExitCode() int {
|
||||
return ee.exitCode
|
||||
}
|
||||
|
||||
func (ee *exitError) Unwrap() error {
|
||||
return ee.err
|
||||
}
|
||||
|
||||
// HandleExitCoder handles errors implementing ExitCoder by printing their
|
||||
// message and calling OsExiter with the given exit code.
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue