Skip to content

Commit

Permalink
spanner: fix time.Time comparisons for upcoming Go1.9 monotonic times
Browse files Browse the repository at this point in the history
An upcoming change in Go1.9 changes the time.Time type to make a
measurement of both the wall clock and a monotonic clock. The
existence of a monotonic measurement makes it such that direct
equality and use of reflect.DeepEqual now fail. Fix by using a
specific date instead of time.Now, so that equality continues to
work. Do note that the documentation for time.Time has alwys
discouraged the use of == and instead recommended the use of the Equal
method.

See https://golang.org/design/12914-monotonic

Change-Id: I733678c5552e1618751b7c41d444230666def381
Reviewed-on: https://code-review.googlesource.com/11254
Reviewed-by: Damien Neil <[email protected]>
Reviewed-by: Vikas Kedia <[email protected]>
  • Loading branch information
jba committed Mar 9, 2017
1 parent 1ba9ec4 commit cc13a9b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion spanner/row_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
)

var (
tm = time.Now().UTC()
tm = time.Date(2016, 11, 15, 0, 0, 0, 0, time.UTC)
dt, _ = civil.ParseDate("2016-11-15")
// row contains a column for each unique Cloud Spanner type.
row = Row{
Expand Down

0 comments on commit cc13a9b

Please sign in to comment.