Remix.run Logo
antonvs 2 hours ago

The point of the OP is that it changes calls to `time.Now` regardless of whether the code that's calling it uses your variable or not.

Groxx 2 hours ago | parent [-]

I suspect that using a build tag (say `test`) and two function definitions (one that directly calls `time.Now()` and one test-only one that uses a mutable var) will optimize out to zero cost in the non-test case - last I fiddled with that, it was pretty good at consistently inlining trivial wrapper funcs like that.