Commit graph

8 commits

Author SHA1 Message Date
Matt Layher 18b6627f33 device, ratelimiter: replace uses of time.Now().Sub() with time.Since()
Simplification found by staticcheck:

$ staticcheck ./... | grep S1012
device/cookie.go:90:5: should use time.Since instead of time.Now().Sub (S1012)
device/cookie.go:127:5: should use time.Since instead of time.Now().Sub (S1012)
device/cookie.go:242:5: should use time.Since instead of time.Now().Sub (S1012)
device/noise-protocol.go:304:13: should use time.Since instead of time.Now().Sub (S1012)
device/receive.go:82:46: should use time.Since instead of time.Now().Sub (S1012)
device/send.go:132:5: should use time.Since instead of time.Now().Sub (S1012)
device/send.go:139:5: should use time.Since instead of time.Now().Sub (S1012)
device/send.go:235:59: should use time.Since instead of time.Now().Sub (S1012)
device/send.go:393:9: should use time.Since instead of time.Now().Sub (S1012)
ratelimiter/ratelimiter.go:79:10: should use time.Since instead of time.Now().Sub (S1012)
ratelimiter/ratelimiter.go:87:10: should use time.Since instead of time.Now().Sub (S1012)

Change applied using:

$ find . -type f -name "*.go" -exec sed -i "s/Now().Sub(/Since(/g" {} \;

Signed-off-by: Matt Layher <mdlayher@gmail.com>
2019-06-03 22:15:41 +02:00
Jason A. Donenfeld 89d2c5ed7a Extend structs rather than embed, when possible 2019-02-05 12:59:42 +01:00
Jason A. Donenfeld dff424baf8 Update copyright 2019-02-05 12:59:42 +01:00
Jason A. Donenfeld 5be541d147 global: fix up copyright headers 2018-09-16 18:49:19 +02:00
Jason A. Donenfeld e28d70f5b2 ratelimiter: do not run GC with nothing to do 2018-05-21 03:20:18 +02:00
Jason A. Donenfeld e94185681f Cleanup ratelimiter 2018-05-13 18:42:06 +02:00
Jason A. Donenfeld a040786645 global: Add SPDX tags and copyright header
Mathias should probably add his copyright headers to each file too.
2018-05-03 15:06:25 +02:00
Jason A. Donenfeld ff8f3a412e Use relative imports 2018-02-12 23:49:41 +01:00