From 835d5f3547f10ede1997a938d9278a506a089bb7 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Sun, 26 Apr 2020 17:31:33 +0200 Subject: Some linting remarks --- pkg/util/util.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'pkg/util/util.go') 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) } -- cgit v1.2.3-54-g00ecf