]> Cypherpunks repositories - gostls13.git/commit
log/slog: handle times with undefined UnixNanos
authorJonathan Amsterdam <jba@google.com>
Thu, 16 May 2024 12:14:52 +0000 (08:14 -0400)
committerJonathan Amsterdam <jba@google.com>
Thu, 16 May 2024 16:12:08 +0000 (16:12 +0000)
commitdb7bb2742ce01601842e277e7808d225ff8390cd
treefe7f86b8743f3f91ed71082fa5fb840803f4fd85
parent505000b2d38c4c93aa7d30e82c61b76a6925b4e9
log/slog: handle times with undefined UnixNanos

slog tries to represent a time.Time without allocations, which involves
storing its UnixNanos value. But UnixNanos is undefined for some valid
times. Provide a fallback representation for those times by storing them
in the `any` field of `Value`.

Fixes #65902.

Change-Id: I736c739a92f77d7b1122ea0831524acdd2c4703f
Reviewed-on: https://go-review.googlesource.com/c/go/+/585519
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
src/log/slog/value.go
src/log/slog/value_test.go