Hacker News new | past | comments | ask | show | jobs | submit login

I agree. I first started doing this (instead of the often recommended global monkey patch) when I started programming in Go.

In our main application we pass in a function that returns `time.Now()`, and in tests we pass in a function that returns whatever time object we want.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: