diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-02-10 10:41:38 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-10 10:41:38 -0500 |
commit | 88ab83d4e04f2054713461c3f28d905b4c1c2ee2 (patch) | |
tree | 9a16fd35768ad78a6c28d85ad0191b3f9d6f03e4 /vendor/github.com/spf13/cobra/cobra.go | |
parent | 832639ca6d1d8004c46aaa4e6c021dfd5a314af3 (diff) | |
parent | 46b014bad5f1d471a2ebfd819dfdf33a184ea109 (diff) | |
download | podman-88ab83d4e04f2054713461c3f28d905b4c1c2ee2.tar.gz podman-88ab83d4e04f2054713461c3f28d905b4c1c2ee2.tar.bz2 podman-88ab83d4e04f2054713461c3f28d905b4c1c2ee2.zip |
Merge pull request #9298 from containers/dependabot/go_modules/github.com/spf13/cobra-1.1.2
Bump github.com/spf13/cobra from 1.1.1 to 1.1.2
Diffstat (limited to 'vendor/github.com/spf13/cobra/cobra.go')
-rw-r--r-- | vendor/github.com/spf13/cobra/cobra.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/vendor/github.com/spf13/cobra/cobra.go b/vendor/github.com/spf13/cobra/cobra.go index d01becc8f..d6cbfd719 100644 --- a/vendor/github.com/spf13/cobra/cobra.go +++ b/vendor/github.com/spf13/cobra/cobra.go @@ -19,6 +19,7 @@ package cobra import ( "fmt" "io" + "os" "reflect" "strconv" "strings" @@ -205,3 +206,17 @@ func stringInSlice(a string, list []string) bool { } return false } + +// CheckErr prints the msg with the prefix 'Error:' and exits with error code 1. If the msg is nil, it does nothing. +func CheckErr(msg interface{}) { + if msg != nil { + fmt.Fprintln(os.Stderr, "Error:", msg) + os.Exit(1) + } +} + +// WriteStringAndCheck writes a string into a buffer, and checks if the error is not nil. +func WriteStringAndCheck(b io.StringWriter, s string) { + _, err := b.WriteString(s) + CheckErr(err) +} |