Skip to content

Commit

Permalink
Refactor: remove ContinueWithError (#630)
Browse files Browse the repository at this point in the history
* Update util.go

Remove Continue with error function

* Update cmd/util.go

Co-authored-by: Liz Rice <liz@lizrice.com>

* 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.
rubygems/heroku-buildpack-bundler2#1 (comment)

Co-authored-by: Liz Rice <liz@lizrice.com>
  • Loading branch information
yoavrotems and lizrice committed Aug 10, 2020
1 parent 6684979 commit 4b9453b
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions cmd/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, ",")
Expand All @@ -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)
}
Expand Down Expand Up @@ -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))
Expand All @@ -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))
Expand Down

0 comments on commit 4b9453b

Please sign in to comment.