Skip to content

Instantly share code, notes, and snippets.

@yanshiyason
Created February 16, 2019 20:30
Show Gist options
  • Save yanshiyason/f59a5c9a449c681063f54d99fa771189 to your computer and use it in GitHub Desktop.
Save yanshiyason/f59a5c9a449c681063f54d99fa771189 to your computer and use it in GitHub Desktop.
func laterInTime(days time.Duration, do func()) {
resetTime := func() {
jwt.TimeFunc = func() time.Time {
return time.Now()
}
}
defer resetTime()
jwt.TimeFunc = func() time.Time {
return time.Now().Add(time.Hour * 24 * days)
}
do()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment