Closed
Description
background
Time is hard and time.Time
is really great in most all cases, but between the two issues (#45958 #45960) I came across recently, it seems like anything that does a runtime equality check is probably a bug. Please let me know if there are cases where comparing time is good, safe, and necessary.
summary
As such, it seems reasonable to add a vet check to disallow using time.Time
like so:
if time.Time{} == time.Time{} {}
map[time.Time]struct{}{{}: {}}
alternatives
I support enforcing this via the complier, but I get the impression that is a non starter:
package time
type Time struct {
_ [0]func()
wall uint64
ext int64
loc *Location
}
We could also add a new symbol that is intentionally comparable, say time.Comparable
, but it would be somewhat confusing when to use which one, and that would probably involve a go vet
rule too.