aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorMichael Anthony Knyszek <mknyszek@google.com>2025-06-11 21:35:29 +0000
committerMichael Knyszek <mknyszek@google.com>2025-06-16 10:05:39 -0700
commitea00461b17c7579d1c9aff2398953b61747ce642 (patch)
treec853e3e05ca3de4f469a94c476b745c18ae73f93 /src/cmd
parent96a6e147b2b02b1f070d559cb2c8e1c25c9b78c3 (diff)
downloadgo-ea00461b17c7579d1c9aff2398953b61747ce642.tar.xz
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>
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/trace/gen.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cmd/trace/gen.go b/src/cmd/trace/gen.go
index 4455f83046..9cc22df1f6 100644
--- a/src/cmd/trace/gen.go
+++ b/src/cmd/trace/gen.go
@@ -283,11 +283,11 @@ func (g *globalMetricGenerator) GlobalMetric(ctx *traceContext, ev *trace.Event)
m := ev.Metric()
switch m.Name {
case "/memory/classes/heap/objects:bytes":
- ctx.HeapAlloc(ctx.elapsed(ev.Time()), m.Value.ToUint64())
+ ctx.HeapAlloc(ctx.elapsed(ev.Time()), m.Value.Uint64())
case "/gc/heap/goal:bytes":
- ctx.HeapGoal(ctx.elapsed(ev.Time()), m.Value.ToUint64())
+ ctx.HeapGoal(ctx.elapsed(ev.Time()), m.Value.Uint64())
case "/sched/gomaxprocs:threads":
- ctx.Gomaxprocs(m.Value.ToUint64())
+ ctx.Gomaxprocs(m.Value.Uint64())
}
}