The simple way to do this is to create new Time using the previous one and only assigning the year month and day. It would look like this;
func truncateToDay(t time.Time) time.Time {
return time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, t.Location())
}
here’s a play example; https://play.golang.org/p/jnFuZxruKm