log/slog: return if error happens

Change-Id: I1780ea2cdc057ecb57bf72551bfd0904c1ad505f
GitHub-Last-Rev: a11799fe16
GitHub-Pull-Request: golang/go#78901
Reviewed-on: https://go-review.googlesource.com/c/go/+/769622
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Weixie Cui 2026-04-22 13:06:19 +00:00 committed by Gopher Robot
parent 8fe0c0eb63
commit be45023407

View file

@ -95,6 +95,7 @@ func appendJSONTime(s *handleState, t time.Time) {
// RFC 3339 is clear that years are 4 digits exactly.
// See golang.org/issue/4556#c15 for more discussion.
s.appendError(errors.New("time.Time year outside of range [0,9999]"))
return
}
s.buf.WriteByte('"')
*s.buf = t.AppendFormat(*s.buf, time.RFC3339Nano)