From 8d34c93eba19472077c9fbc6686ddbc5925d1aad Mon Sep 17 00:00:00 2001 From: Andinus Date: Mon, 16 Mar 2020 03:20:59 +0530 Subject: Fix logical error in ErrChk, bump version & remove RandAlNum --- pkg/cetus/cetus.go | 8 +++++--- pkg/cetus/random.go | 16 ---------------- 2 files changed, 5 insertions(+), 19 deletions(-) delete mode 100644 pkg/cetus/random.go (limited to 'pkg') diff --git a/pkg/cetus/cetus.go b/pkg/cetus/cetus.go index 7005c9d..dbf72f8 100644 --- a/pkg/cetus/cetus.go +++ b/pkg/cetus/cetus.go @@ -5,7 +5,7 @@ import ( "log" ) -var version string = "v0.4.7" +var version string = "v0.4.8" // Version prints cetus version func Version() { @@ -19,6 +19,8 @@ func PrintPath(path string) { // ErrChk logs the context & error func ErrChk(ctx string, err error) { - log.Println(ctx) - log.Fatal(err) + if err != nil { + log.Println(ctx) + log.Fatal(err) + } } diff --git a/pkg/cetus/random.go b/pkg/cetus/random.go deleted file mode 100644 index d77a24b..0000000 --- a/pkg/cetus/random.go +++ /dev/null @@ -1,16 +0,0 @@ -package cetus - -import ( - "math/rand" -) - -// RandAlNum returns random alpha-numeric string of specific length -func RandAlNum(n int) string { - rand.Seed(time.Now().UnixNano()) - const alphanum = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" - b := make([]byte, n) - for i := range b { - b[i] = letterBytes[rand.Intn(len(letterBytes))] - } - return string(b) -} -- cgit 1.4.1-2-gfad0