]> Cypherpunks repositories - gostls13.git/commit
internal/trace: make Value follow reflect conventions
authorMichael Anthony Knyszek <mknyszek@google.com>
Wed, 11 Jun 2025 21:35:29 +0000 (21:35 +0000)
committerMichael Knyszek <mknyszek@google.com>
Mon, 16 Jun 2025 17:05:39 +0000 (10:05 -0700)
commitea00461b17c7579d1c9aff2398953b61747ce642
treec853e3e05ca3de4f469a94c476b745c18ae73f93
parent96a6e147b2b02b1f070d559cb2c8e1c25c9b78c3
internal/trace: make Value follow reflect conventions

A previous change renamed Value.Uint64 to Value.ToUint64 to accomodate
string values. The method for a string value is then Value.ToString,
while the method for a debug string (for example, for fmt) is just
called String, as per fmt.Stringer.

This change follows a request from Dominik Honnef, maintainer of
gotraceui, to make Value follow the conventions of the reflect package.
The Value type there has a method String which fulfills both purposes:
getting the string for a String Value, and as fmt.Stringer. It's
not exactly pretty, but it does make sense to just stick to convention.

Change-Id: I55b364be88088d2121527bffc833ef03dbdb9764
Reviewed-on: https://go-review.googlesource.com/c/go/+/680978
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
src/cmd/trace/gen.go
src/internal/trace/event.go
src/internal/trace/gc.go
src/internal/trace/testtrace/validation.go
src/internal/trace/value.go