From: Simon Ruderich Date: Sun, 15 Dec 2019 14:52:49 +0000 (+0100) Subject: nsscash: main_test: use time.Since() X-Git-Tag: 0.1~2 X-Git-Url: https://ruderich.org/simon/gitweb/?p=nsscash%2Fnsscash.git;a=commitdiff_plain;h=2f775b91b1871aa2eacdb19ead52f8801ba75b29 nsscash: main_test: use time.Since() --- diff --git a/main_test.go b/main_test.go index 145abe9..ffb176f 100644 --- a/main_test.go +++ b/main_test.go @@ -166,8 +166,7 @@ func mustBeOld(t *testing.T, paths ...string) { } mtime := i.ModTime() - now := time.Now() - if now.Sub(mtime) < time.Hour { + if time.Since(mtime) < time.Hour { t.Errorf("%q was recently modified", p) } } @@ -182,8 +181,7 @@ func mustBeNew(t *testing.T, paths ...string) { } mtime := i.ModTime() - now := time.Now() - if now.Sub(mtime) > time.Hour { + if time.Since(mtime) > time.Hour { t.Errorf("%q was not recently modified", p) } }