Skip to content

Commit

Permalink
Fix docs
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Sverdlov <[email protected]>
  • Loading branch information
sverdlov93 committed Aug 20, 2023
1 parent 0ed2a3b commit c995b8f
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions utils/coreutils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ func PanicOnError(err error) error {
}

func ExitOnErr(err error) {
if err, ok := err.(CliError); ok {
traceExit(err.ExitCode, err)
var cliError CliError
if errors.As(err, &cliError) {
traceExit(cliError.ExitCode, err)
}
if exitCode := GetExitCode(err, 0, 0, false); exitCode != ExitCodeNoError {
traceExit(exitCode, err)
Expand Down Expand Up @@ -153,7 +154,8 @@ func GetExitCode(err error, success, failed int, failNoOp bool) ExitCode {
// We would like to return a regular error instead of ExitError,
// because some frameworks (such as codegangsta used by JFrog CLI) automatically exit when this error is returned.
func ConvertExitCodeError(err error) error {
if _, ok := err.(*exec.ExitError); ok {
var exitError *exec.ExitError
if errors.As(err, &exitError) {
err = errors.New(err.Error())
}
return err
Expand Down Expand Up @@ -211,17 +213,14 @@ func varsAsMap(vars []string) map[string]string {
}

func IsWindows() bool {
// noinspection
return runtime.GOOS == "windows"
}

func IsLinux() bool {
// noinspection
return runtime.GOOS == "linux"
}

func IsMac() bool {
// noinspection
return runtime.GOOS == "darwin"
}

Expand All @@ -233,7 +232,6 @@ func GetOSAndArc() (string, error) {
}
// Mac
if IsMac() {
// noinspection
if arch == "arm64" {
return "mac-arm64", nil
} else {
Expand Down

0 comments on commit c995b8f

Please sign in to comment.