aboutsummaryrefslogtreecommitdiff
path: root/src/internal/trace/trace_test.go
diff options
context:
space:
mode:
authorFelix Geisendörfer <felix.geisendoerfer@datadoghq.com>2024-08-27 20:46:33 +0200
committerMichael Knyszek <mknyszek@google.com>2024-09-23 15:02:19 +0000
commit89a5a60da623ca9e7f91a93cd34b35785e30ab7e (patch)
treecc8a8a2ee862115fab3c011d34bf3f4f46e16161 /src/internal/trace/trace_test.go
parentcfbd2e7b40fac7809a404c49c46106e259078a61 (diff)
downloadgo-89a5a60da623ca9e7f91a93cd34b35785e30ab7e.tar.xz
internal/trace: refactor Stack.Frames to return iter.Seq
The Frames function is almost an iter.Seq, except for its bool return value. Since none of the callers in the Go tree rely on the bool, we can remove it. However, doing so might still obscure the intended usage as an iterator. This refactor changes the API to return iter.Seq, making the intended usage explicit. Refactoring the existing callers to take advantage of the new interface will be done in a follow-up CL. Change-Id: I03e4d6d762910e418cc37d59a6c519eb7f39b3b0 Reviewed-on: https://go-review.googlesource.com/c/go/+/608855 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/internal/trace/trace_test.go')
-rw-r--r--src/internal/trace/trace_test.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/internal/trace/trace_test.go b/src/internal/trace/trace_test.go
index 1929069cc5..dcf9d05fb4 100644
--- a/src/internal/trace/trace_test.go
+++ b/src/internal/trace/trace_test.go
@@ -148,7 +148,7 @@ func TestTraceCPUProfile(t *testing.T) {
if hogRegion != nil && ev.Goroutine() == hogRegion.Goroutine() {
traceSamples++
var fns []string
- ev.Stack().Frames(func(frame trace.StackFrame) bool {
+ ev.Stack().Frames()(func(frame trace.StackFrame) bool {
if frame.Func != "runtime.goexit" {
fns = append(fns, fmt.Sprintf("%s:%d", frame.Func, frame.Line))
}
@@ -438,7 +438,7 @@ func TestTraceStacks(t *testing.T) {
stackMatches := func(stk trace.Stack, frames []frame) bool {
i := 0
match := true
- stk.Frames(func(f trace.StackFrame) bool {
+ stk.Frames()(func(f trace.StackFrame) bool {
if f.Func != frames[i].fn {
match = false
return false