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/?a=commitdiff_plain;ds=sidebyside;h=2f775b91b1871aa2eacdb19ead52f8801ba75b29;hp=999fa3508eab3bba561202b91c520aaa5893bf11;p=nsscash%2Fnsscash.git 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) } }