From 75fd7c03b1a8018f85e2da779ab59b86ad0efb58 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 13 May 2026 10:32:36 +0300 Subject: fix: move context.Context to first parameter in startTraceCmd and startTraceCmdWithTimeout Per Go convention, context.Context must always be the first parameter. Updated both function signatures and all call sites in tracelifecycle.go and tui_test.go. Co-Authored-By: Claude Sonnet 4.6 --- internal/tui/tui_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'internal/tui/tui_test.go') diff --git a/internal/tui/tui_test.go b/internal/tui/tui_test.go index a685719..5f007e4 100644 --- a/internal/tui/tui_test.go +++ b/internal/tui/tui_test.go @@ -202,7 +202,7 @@ func TestQuitKeyMatchesSingleBindingWithoutPanic(t *testing.T) { } func TestStartTraceCmdLaunchesBeforeStarterReturns(t *testing.T) { - cmd := startTraceCmd(func(context.Context) error { return nil }, context.Background()) + cmd := startTraceCmd(context.Background(), func(context.Context) error { return nil }) msg := cmd() if _, ok := msg.(TracingStartedMsg); !ok { t.Fatalf("expected TracingStartedMsg, got %T", msg) @@ -210,7 +210,7 @@ func TestStartTraceCmdLaunchesBeforeStarterReturns(t *testing.T) { } func TestStartTraceCmdEmitsErrorMsg(t *testing.T) { - cmd := startTraceCmd(func(context.Context) error { return errors.New("trace failed") }, context.Background()) + cmd := startTraceCmd(context.Background(), func(context.Context) error { return errors.New("trace failed") }) msg := cmd() traceErr, ok := msg.(TracingErrorMsg) if !ok { @@ -235,7 +235,7 @@ func TestStartTraceCmdTimeoutEmitsErrorMsg(t *testing.T) { } // Use a short timeout so the test finishes quickly. - cmd := startTraceCmdWithTimeout(blocker, ctx, 50*time.Millisecond) + cmd := startTraceCmdWithTimeout(ctx, blocker, 50*time.Millisecond) msg := cmd() traceErr, ok := msg.(TracingErrorMsg) @@ -265,7 +265,7 @@ func TestStartTraceCmdContextCancelledBeforeTimeoutReturnsNil(t *testing.T) { // Cancel ctx immediately so the starter exits before the timeout. cancel() - cmd := startTraceCmdWithTimeout(blocker, ctx, 5*time.Second) + cmd := startTraceCmdWithTimeout(ctx, blocker, 5*time.Second) msg := cmd() if msg != nil { -- cgit v1.2.3