aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/trace
diff options
context:
space:
mode:
authorNick Ripley <nick.ripley@datadoghq.com>2023-02-10 14:08:27 -0500
committerGopher Robot <gobot@golang.org>2023-02-10 21:45:16 +0000
commitf0cb44a7736df649cdb5c7b3dfe8e270ae691626 (patch)
tree74a9fdc2d508d7b0755cd7c19f4938e6df2cae89 /src/cmd/trace
parent117d5588bde2d1f1f830c3d763bf4f8e999a12c1 (diff)
downloadgo-f0cb44a7736df649cdb5c7b3dfe8e270ae691626.tar.xz
cmd/trace: fix error message for bad goroutine state transition
The error message when an invalid goroutine state transition is found in a trace should show the current state, not the next state, when comparing against the expected current state. This CL also picks up a gofmt change to the file. Change-Id: Ic0ce6c9ce79d8a784b73b115b5db76c311b8593d Reviewed-on: https://go-review.googlesource.com/c/go/+/467416 Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: David Chase <drchase@google.com> Run-TryBot: Michael Knyszek <mknyszek@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/cmd/trace')
-rw-r--r--src/cmd/trace/trace.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/trace/trace.go b/src/cmd/trace/trace.go
index 84fca62a04..895129998f 100644
--- a/src/cmd/trace/trace.go
+++ b/src/cmd/trace/trace.go
@@ -338,7 +338,7 @@ func stackFrameEncodedSize(id uint, f traceviewer.Frame) int {
// The parent is omitted if 0. The trailing comma is omitted from the
// last entry, but we don't need that much precision.
const (
- baseSize = len(`"`) + len (`":{"name":"`) + len(`"},`)
+ baseSize = len(`"`) + len(`":{"name":"`) + len(`"},`)
// Don't count the trailing quote on the name, as that is
// counted in baseSize.
@@ -647,7 +647,7 @@ func generateTrace(params *traceParams, consumer traceConsumer) error {
oldState = info.state
}
if info.state != oldState && setGStateErr == nil {
- setGStateErr = fmt.Errorf("expected G %d to be in state %d, but got state %d", g, oldState, newState)
+ setGStateErr = fmt.Errorf("expected G %d to be in state %d, but got state %d", g, oldState, info.state)
}
ctx.gstates[info.state]--
ctx.gstates[newState]++