From 4b9453bb83249b7daaa1b84bc5a6f261fa23bd92 Mon Sep 17 00:00:00 2001 From: yoavrotems Date: Mon, 10 Aug 2020 12:12:57 +0300 Subject: [PATCH] Refactor: remove ContinueWithError (#630) * Update util.go Remove Continue with error function * Update cmd/util.go Co-authored-by: Liz Rice * Update util.go * Update util.go Remove unnecessary ')' * Update util.go removed fmt.Fprintf(os.Stderr, "%s: %s", cmd.Args, err) since it wasn't suppose to print. * Update util.go * Update .travis.yml option --no-ri and --no-doc are deprecated we have to use --no-document instead. https://github.com/rubygems/heroku-buildpack-bundler2/pull/1#issuecomment-451654992 Co-authored-by: Liz Rice --- cmd/util.go | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/cmd/util.go b/cmd/util.go index c716ecf..4dd7f87 100644 --- a/cmd/util.go +++ b/cmd/util.go @@ -48,18 +48,6 @@ func exitWithError(err error) { os.Exit(1) } -func continueWithError(err error, msg string) string { - if err != nil { - glog.V(2).Info(err) - } - - if msg != "" { - fmt.Fprintf(os.Stderr, "%s\n", msg) - } - - return "" -} - func cleanIDs(list string) map[string]bool { list = strings.Trim(list, ",") ids := strings.Split(list, ",") @@ -82,9 +70,9 @@ func ps(proc string) string { cmd := exec.Command("/bin/ps", "-C", proc, "-o", "cmd", "--no-headers") out, err := cmd.Output() if err != nil { - continueWithError(fmt.Errorf("%s: %s", cmd.Args, err), "") + glog.V(2).Info(fmt.Errorf("%s: %s", cmd.Args, err)) } - + glog.V(2).Info(fmt.Sprintf("ps - returning: %q", string(out))) return string(out) } @@ -325,7 +313,7 @@ func getKubeVersionFromKubectl() string { cmd := exec.Command("kubectl", "version", "--short") out, err := cmd.CombinedOutput() if err != nil { - continueWithError(fmt.Errorf("%s", out), "") + glog.V(2).Info(err) } return getVersionFromKubectlOutput(string(out)) @@ -336,7 +324,7 @@ func getKubeVersionFromKubelet() string { out, err := cmd.CombinedOutput() if err != nil { - continueWithError(fmt.Errorf("%s", out), "") + glog.V(2).Info(err) } return getVersionFromKubeletOutput(string(out))