aboutsummaryrefslogtreecommitdiff
path: root/pkg/timetype
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-04-27 04:50:01 -0400
committerGitHub <noreply@github.com>2022-04-27 04:50:01 -0400
commit053b09660ffbe2df2104186c67e39be70764ff63 (patch)
treeb9d8d32e146eb1ca1a3385e61b24d276dabc1cf0 /pkg/timetype
parent5ac00a7287e4a9e6292f4a6ca5dfa9a02e5ca907 (diff)
parent4f8ece76fff31d31570af56e0ec4a4092e015b33 (diff)
downloadpodman-053b09660ffbe2df2104186c67e39be70764ff63.tar.gz
podman-053b09660ffbe2df2104186c67e39be70764ff63.tar.bz2
podman-053b09660ffbe2df2104186c67e39be70764ff63.zip
Merge pull request #13997 from Luap99/gocritic
enable gocritic linter
Diffstat (limited to 'pkg/timetype')
-rw-r--r--pkg/timetype/timestamp.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/pkg/timetype/timestamp.go b/pkg/timetype/timestamp.go
index 2de1a005f..5e9c6a159 100644
--- a/pkg/timetype/timestamp.go
+++ b/pkg/timetype/timestamp.go
@@ -34,13 +34,14 @@ func GetTimestamp(value string, reference time.Time) (string, error) {
// if the string has a Z or a + or three dashes use parse otherwise use parseinlocation
parseInLocation := !(strings.ContainsAny(value, "zZ+") || strings.Count(value, "-") == 3)
- if strings.Contains(value, ".") { // nolint(gocritic)
+ switch {
+ case strings.Contains(value, "."):
if parseInLocation {
format = rFC3339NanoLocal
} else {
format = time.RFC3339Nano
}
- } else if strings.Contains(value, "T") {
+ case strings.Contains(value, "T"):
// we want the number of colons in the T portion of the timestamp
tcolons := strings.Count(value, ":")
// if parseInLocation is off and we have a +/- zone offset (not Z) then
@@ -68,9 +69,9 @@ func GetTimestamp(value string, reference time.Time) (string, error) {
format = time.RFC3339
}
}
- } else if parseInLocation {
+ case parseInLocation:
format = dateLocal
- } else {
+ default:
format = dateWithZone
}