[go] slog: use time.Time.AppendFormat to write value

0 views
Skip to first unread message

Gerrit Bot (Gerrit)

unread,
1:00 PM (2 hours ago) 1:00 PM
to goph...@pubsubhelper.golang.org, Patricio Whittingslow, golang-co...@googlegroups.com

Gerrit Bot has uploaded the change for review

Commit message

slog: use time.Time.AppendFormat to write value

Avoid allocating a string by using the append method on time.Time.
Change-Id: Ia0a9913680e20e28e9074660fe77cdbde21940a2
GitHub-Last-Rev: 0d55e5990d860673d3818ee21cdb731e5dcce058
GitHub-Pull-Request: golang/go#77852

Change diff

diff --git a/src/log/slog/value.go b/src/log/slog/value.go
index 6b0768e..0271d51 100644
--- a/src/log/slog/value.go
+++ b/src/log/slog/value.go
@@ -470,7 +470,7 @@
case KindDuration:
return append(dst, v.duration().String()...)
case KindTime:
- return append(dst, v.time().String()...)
+ return v.time().AppendFormat(dst, "2006-01-02 15:04:05.999999999 -0700 MST")
case KindGroup:
return fmt.Append(dst, v.group())
case KindAny, KindLogValuer:

Change information

Files:
  • M src/log/slog/value.go
Change size: XS
Delta: 1 file changed, 1 insertion(+), 1 deletion(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ia0a9913680e20e28e9074660fe77cdbde21940a2
Gerrit-Change-Number: 749960
Gerrit-PatchSet: 1
Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
Gerrit-CC: Patricio Whittingslow <grad...@gmail.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Gopher Robot (Gerrit)

unread,
1:00 PM (2 hours ago) 1:00 PM
to Patricio Whittingslow, Gerrit Bot, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Gopher Robot added 1 comment

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Gopher Robot . unresolved

I spotted some possible problems with your PR:

  1. You usually need to reference a bug number for all but trivial or cosmetic fixes. For this repo, the format is usually 'Fixes #12345' or 'Updates #12345' at the end of the commit message. Should you have a bug reference?

Please address any problems by updating the GitHub PR.

When complete, mark this comment as 'Done' and click the [blue 'Reply' button](https://go.dev/wiki/GerritBot#i-left-a-reply-to-a-comment-in-gerrit-but-no-one-but-me-can-see-it) above. These findings are based on heuristics; if a finding does not apply, briefly reply here saying so.

To update the commit title or commit message body shown here in Gerrit, you must edit the GitHub PR title and PR description (the first comment) in the GitHub web interface using the 'Edit' button or 'Edit' menu entry there. Note: pushing a new commit to the PR will not automatically update the commit message used by Gerrit.

For more details, see:

(In general for Gerrit code reviews, the change author is expected to [log in to Gerrit](https://go-review.googlesource.com/login/) with a Gmail or other Google account and then close out each piece of feedback by marking it as 'Done' if implemented as suggested or otherwise reply to each review comment. See the [Review](https://go.dev/doc/contribute#review) section of the Contributing Guide for details.)

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: Ia0a9913680e20e28e9074660fe77cdbde21940a2
    Gerrit-Change-Number: 749960
    Gerrit-PatchSet: 1
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Patricio Whittingslow <grad...@gmail.com>
    Gerrit-Comment-Date: Fri, 27 Feb 2026 18:00:45 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages