From 89a5a60da623ca9e7f91a93cd34b35785e30ab7e Mon Sep 17 00:00:00 2001 From: Felix Geisendörfer Date: Tue, 27 Aug 2024 20:46:33 +0200 Subject: 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 Reviewed-by: Dmitri Shuralyov Reviewed-by: Michael Knyszek --- src/internal/trace/trace_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/internal/trace/trace_test.go') 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 -- cgit v1.3