summaryrefslogtreecommitdiff
path: root/internal/tui/tracelifecycle.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-13 10:32:36 +0300
committerPaul Buetow <paul@buetow.org>2026-05-13 10:32:36 +0300
commit75fd7c03b1a8018f85e2da779ab59b86ad0efb58 (patch)
treea3b155ad9abb66a820d31e839aa023c1d45c3516 /internal/tui/tracelifecycle.go
parent6d407096405520d5e157235e52773b9a4f3e4396 (diff)
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 <noreply@anthropic.com>
Diffstat (limited to 'internal/tui/tracelifecycle.go')
-rw-r--r--internal/tui/tracelifecycle.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/internal/tui/tracelifecycle.go b/internal/tui/tracelifecycle.go
index 0117169..99b1c86 100644
--- a/internal/tui/tracelifecycle.go
+++ b/internal/tui/tracelifecycle.go
@@ -39,7 +39,7 @@ func (t *traceLifecycle) beginCmd(runtime *runtimeBindings, filter globalfilter.
t.traceStop = cancel
ctx = ContextWithRuntimeBindings(ctx, runtime)
ctx = ContextWithTraceFilters(ctx, filter)
- return startTraceCmd(t.startTrace, ctx)
+ return startTraceCmd(ctx, t.startTrace)
}
// stop cancels the running trace and clears the cancel function. Safe to call
@@ -63,14 +63,16 @@ const defaultStartupTimeout = 30 * time.Second
// cancellation gracefully (returns nil so the caller does not treat a
// user-initiated stop as an error). It uses defaultStartupTimeout to
// prevent the TUI from hanging indefinitely when BPF probe attachment stalls.
-func startTraceCmd(starter TraceStarter, ctx context.Context) tea.Cmd {
- return startTraceCmdWithTimeout(starter, ctx, defaultStartupTimeout)
+// ctx is first per Go convention (context.Context always leads the parameter list).
+func startTraceCmd(ctx context.Context, starter TraceStarter) tea.Cmd {
+ return startTraceCmdWithTimeout(ctx, starter, defaultStartupTimeout)
}
// startTraceCmdWithTimeout is the testable core of startTraceCmd. It races
// the starter goroutine against a caller-supplied timeout so that tests can
// use a short deadline without waiting 30 seconds.
-func startTraceCmdWithTimeout(starter TraceStarter, ctx context.Context, timeout time.Duration) tea.Cmd {
+// ctx is first per Go convention (context.Context always leads the parameter list).
+func startTraceCmdWithTimeout(ctx context.Context, starter TraceStarter, timeout time.Duration) tea.Cmd {
return func() tea.Msg {
type starterResult struct{ err error }
ch := make(chan starterResult, 1)