Skip to content

time: == on time.Time values compiles but doesn't work #8754

@robpike

Description

@robpike
When we permitted == on structs in an earlier release of Go, we accidentally made
time.Time values comparable this way. However, because time.Time values contain a
*Location pointer, it's possible (and easy) to have two time.Times represent the same
instant, even in the same time zone, yet compare unequal. This is a serious bug, as it
enables subtle bugs if a time.Time is used as a key in a map or database.

We need to find a way either to to break == statically or make it work dynamically.

Too late for 1.4, as the issue is subtle. Marking for 1.5.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions