What would be the idiomatic way of getting a duration between two dates or basically getting a future date based on the current. Right now I'm using the below code to achieve that.
yearSpan := time.Date(time.Now().Year()-1, time.Now().Month(),
time.Now().Day(), time.Now().Hour(), time.Now().Minute(), time.Now().Second(),
time.Now().Nanosecond(), time.UTC)
yearDuration := time.Now().Sub(yearSpan)
header.Add("Expires", time.Now().Add(futureDate).String())
I've pretty much looked everywhere in books and sites but I couldn't find any idiomatic way creating a duration. Any thoughts on how to refactor the above code in a better way?
Thanks