1
0
mirror of https://github.com/golang/go synced 2024-11-15 00:40:31 -07:00

internal/trace: fix off-by-one error in arguments for exp events

There's an off-by-one error in computing the Args field for experimental
events, resulting in confusing output. This wasn't caught because no
test actually checks to make sure the experimental arguments make sense
yet.

Change-Id: I339677a80bee6319407fced20d5e0f9c2fd235b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/589055
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
This commit is contained in:
Michael Anthony Knyszek 2024-05-29 16:10:27 +00:00 committed by Gopher Robot
parent 787414ca48
commit 81d424ee9a

View File

@ -663,11 +663,11 @@ func (e Event) Experimental() ExperimentalEvent {
panic("Experimental called on non-Experimental event")
}
spec := go122.Specs()[e.base.typ]
argNames := spec.Args[1:]
argNames := spec.Args[1:] // Skip timestamp; already handled.
return ExperimentalEvent{
Name: spec.Name,
ArgNames: argNames, // Skip timestamp; already handled.
Args: e.base.args[1 : 1+len(argNames)],
ArgNames: argNames,
Args: e.base.args[:len(argNames)],
Data: e.table.expData[spec.Experiment],
}
}