diff options
author | Jon Bratseth <bratseth@oath.com> | 2021-10-01 10:08:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-01 10:08:09 +0200 |
commit | 6287080a207b7862ed020b2d862a7022ea82e91a (patch) | |
tree | 0206364b97fc723eff39e6ae9387332be44557f4 | |
parent | d73a314fa8ff8441c38896c65f67d7c3edf645a2 (diff) | |
parent | 96c1fbcaff4d32d88fe5107640b19a74d5f1df5e (diff) |
Merge pull request #19388 from vespa-engine/mpolden/fix-exit-code
More exit code cleanup
-rw-r--r-- | client/go/Makefile | 3 | ||||
-rw-r--r-- | client/go/cmd/clone.go | 10 | ||||
-rw-r--r-- | client/go/cmd/config.go | 2 | ||||
-rw-r--r-- | client/go/cmd/query.go | 6 |
4 files changed, 10 insertions, 11 deletions
diff --git a/client/go/Makefile b/client/go/Makefile index a491287abfc..49b7c64f5e7 100644 --- a/client/go/Makefile +++ b/client/go/Makefile @@ -29,8 +29,7 @@ all: test checkfmt install # $ git checkout vX.Y.Z # $ make dist-homebrew dist-homebrew: dist-version -# TODO(mpolden): Remove --version=0 after next release - brew bump-formula-pr --tag v$(VERSION) --version=0 vespa-cli + brew bump-formula-pr --tag v$(VERSION) vespa-cli # Create a GitHub release draft for all platforms. Note that this only creates a # draft, which is not publicly visible until it's explicitly published. diff --git a/client/go/cmd/clone.go b/client/go/cmd/clone.go index 9bae300c399..e7d77c83ebb 100644 --- a/client/go/cmd/clone.go +++ b/client/go/cmd/clone.go @@ -48,7 +48,7 @@ variable.`, if listApps { apps, err := listSampleApps() if err != nil { - printErr(err, "Could not list sample applications") + fatalErr(err, "Could not list sample applications") return } for _, app := range apps { @@ -70,7 +70,7 @@ func cloneApplication(source string, name string) { zipReader, zipOpenError := zip.OpenReader(zipFile.Name()) if zipOpenError != nil { - printErr(zipOpenError, "Could not open sample apps zip '", color.Cyan(zipFile.Name()), "'") + fatalErr(zipOpenError, "Could not open sample apps zip '", color.Cyan(zipFile.Name()), "'") return } defer zipReader.Close() @@ -82,7 +82,7 @@ func cloneApplication(source string, name string) { if !found { // Create destination directory lazily when source is found createErr := os.Mkdir(name, 0755) if createErr != nil { - printErr(createErr, "Could not create directory '", color.Cyan(name), "'") + fatalErr(createErr, "Could not create directory '", color.Cyan(name), "'") return } } @@ -90,13 +90,13 @@ func cloneApplication(source string, name string) { copyError := copy(f, name, zipEntryPrefix) if copyError != nil { - printErr(copyError, "Could not copy zip entry '", color.Cyan(f.Name), "' to ", color.Cyan(name)) + fatalErr(copyError, "Could not copy zip entry '", color.Cyan(f.Name), "' to ", color.Cyan(name)) return } } } if !found { - printErr(nil, "Could not find source application '", color.Cyan(source), "'") + fatalErr(nil, "Could not find source application '", color.Cyan(source), "'") } else { log.Print("Created ", color.Cyan(name)) } diff --git a/client/go/cmd/config.go b/client/go/cmd/config.go index a5d6a05a048..d10f66c83c6 100644 --- a/client/go/cmd/config.go +++ b/client/go/cmd/config.go @@ -48,7 +48,7 @@ overridden by setting the VESPA_CLI_HOME environment variable.`, Run: func(cmd *cobra.Command, args []string) { // Root command does nothing cmd.Help() - os.Exit(1) + exitFunc(1) }, } diff --git a/client/go/cmd/query.go b/client/go/cmd/query.go index 66e85763899..76688438fb4 100644 --- a/client/go/cmd/query.go +++ b/client/go/cmd/query.go @@ -50,7 +50,7 @@ func query(arguments []string) { response, err := service.Do(&http.Request{URL: url}, time.Second*time.Duration(queryTimeoutSecs)) if err != nil { - printErr(nil, "Request failed: ", err) + fatalErr(nil, "Request failed: ", err) return } defer response.Body.Close() @@ -58,9 +58,9 @@ func query(arguments []string) { if response.StatusCode == 200 { log.Print(util.ReaderToJSON(response.Body)) } else if response.StatusCode/100 == 4 { - printErr(nil, "Invalid query: ", response.Status, "\n", util.ReaderToJSON(response.Body)) + fatalErr(nil, "Invalid query: ", response.Status, "\n", util.ReaderToJSON(response.Body)) } else { - printErr(nil, response.Status, " from container at ", color.Cyan(url.Host), "\n", util.ReaderToJSON(response.Body)) + fatalErr(nil, response.Status, " from container at ", color.Cyan(url.Host), "\n", util.ReaderToJSON(response.Body)) } } |