Time
Go: Handling time.Now() in Tests
Forget time-mocking libraries — a single function field on your struct is all you need to make time deterministic in Go tests
Time-dependent code is one of the classic pain points in unit testing. A function that calls time.Now() produces a different value every run, and assertions become a moving target. There are popular packages to solve this — but you don’t actually need any of them. A few lines of plain Go are enough.