vendor: add qingstor-sdk-go for QingStor
This commit is contained in:
parent
f682002b84
commit
466dd22b44
136 changed files with 15952 additions and 1 deletions
21
vendor/github.com/pengsrc/go-shared/check/error.go
generated
vendored
Normal file
21
vendor/github.com/pengsrc/go-shared/check/error.go
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
package check
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
// ErrorForExit check the error.
|
||||
// If error is not nil, print the error message and exit the application.
|
||||
// If error is nil, do nothing.
|
||||
func ErrorForExit(name string, err error, code ...int) {
|
||||
if err != nil {
|
||||
exitCode := 1
|
||||
if len(code) > 0 {
|
||||
exitCode = code[0]
|
||||
}
|
||||
fmt.Fprintf(os.Stderr, "%s: %s (%d)\n", name, err.Error(), exitCode)
|
||||
fmt.Fprintf(os.Stderr, "See \"%s --help\".\n", name)
|
||||
os.Exit(exitCode)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue