Skip to content

time-value-equality

Compare time.Time values with Time.Equal.

Updated View as Markdown

Default severity: warning

The == and != operators compare every field of time.Time, including monotonic-clock and location representation details. Time.Equal compares the represented instants.

Bad

if first == second {
	match()
}

Good

if first.Equal(second) {
	match()
}
Navigation

Type to search…

↑↓ navigate↵ selectEsc close