diff options
author | Valery Piashchynski <[email protected]> | 2020-02-10 12:25:56 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-02-10 12:25:56 +0300 |
commit | 02be3eec1d8323a16031e86c1ddcc5c52c440176 (patch) | |
tree | ade1230c7d4b9a23997e414e6622094ceb0fb5fa /cmd | |
parent | 809458f32ff2676e35027f6cce1cbf6ae768423a (diff) |
Add go.sum to VCS (it contains hashes, so, should be commited)
Return and process error from cprint and exit.go functions
Update build.sh, remove LDFLAGS and CGO directives
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/util/cprint.go | 8 | ||||
-rw-r--r-- | cmd/util/exit.go | 6 |
2 files changed, 11 insertions, 3 deletions
diff --git a/cmd/util/cprint.go b/cmd/util/cprint.go index 85202b0a..3a986fd6 100644 --- a/cmd/util/cprint.go +++ b/cmd/util/cprint.go @@ -38,6 +38,10 @@ func Sprintf(format string, args ...interface{}) string { } // Panicf prints `<white+hb>color formatted message to STDERR</reset>`. -func Panicf(format string, args ...interface{}) { - fmt.Fprint(os.Stderr, Sprintf(format, args...)) +func Panicf(format string, args ...interface{}) error { + _, err := fmt.Fprint(os.Stderr, Sprintf(format, args...)) + if err != nil { + return err + } + return nil } diff --git a/cmd/util/exit.go b/cmd/util/exit.go index 96fcbf3c..8871a483 100644 --- a/cmd/util/exit.go +++ b/cmd/util/exit.go @@ -6,6 +6,10 @@ import ( // ExitWithError prints error and exits with error code`. func ExitWithError(err error) { - Panicf("<red+hb>Error:</reset> <red>%s</reset>\n", err) + errP := Panicf("<red+hb>Error:</reset> <red>%s</reset>\n", err) + if errP != nil { + // in case of error during Panicf, print this error via build-int print function + println("error occurred during fmt.Fprint: " + err.Error()) + } os.Exit(1) } |