diff options
Diffstat (limited to 'pkg/util')
-rw-r--r-- | pkg/util/util.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/pkg/util/util.go b/pkg/util/util.go index 659c886..88d04c0 100644 --- a/pkg/util/util.go +++ b/pkg/util/util.go @@ -2,6 +2,7 @@ package util import "time" +// StrContains searches for `needle` in `haystack` and returns `true` if found. func StrContains(haystack []string, needle string) bool { for _, s := range haystack { if s == needle { @@ -12,10 +13,11 @@ func StrContains(haystack []string, needle string) bool { return false } +// TimeFormat formats the given time, where an empty time is formatted as "not set". func TimeFormat(t time.Time) string { if t.IsZero() { return "not set" - } else { - return t.Format(time.ANSIC) } + + return t.Format(time.ANSIC) } |