SyntaxFix
Write A Post
Hire A Developer
Questions
You can negate a time.Duration:
time.Duration
then := now.Add(- dur)
You can even compare a time.Duration against 0:
0
if dur > 0 { dur = - dur } then := now.Add(dur)
You can see a working example at http://play.golang.org/p/ml7svlL4eW