Skip to content

lint: enable noctx and deduplicate touched code#2508

Merged
dgageot merged 1 commit intodocker:mainfrom
dgageot:board/enable-additional-linters-with-per-linte-ebcb77f9
Apr 27, 2026
Merged

lint: enable noctx and deduplicate touched code#2508
dgageot merged 1 commit intodocker:mainfrom
dgageot:board/enable-additional-linters-with-per-linte-ebcb77f9

Conversation

@dgageot
Copy link
Copy Markdown
Member

@dgageot dgageot commented Apr 25, 2026

Adds noctx to the enabled golangci-lint set and threads context through the HTTP, SQL, exec and net APIs it flags.

  • Tests use t.Context() with the *Context / WithContext variants.
  • Production code passes ctx where it is already in scope, uses context.Background() for genuine background work (DB schema migrations, sqlite Ping at startup, fire-and-forget audio playback) and adds //nolint:noctx for the few intentionally non-context-bound calls (tea.ExecProcess-driven interactive shells/editors and the explicit kill+WaitDelay flow in the shell tool).

While here, factor out the patterns that ended up duplicated:

  • pkg/sqliteutil.CheckpointAndClose, used by the three RAG strategy databases.
  • pkg/skills.httpGet, used by both cache.go and remote.go.
  • pkg/sound.runDetached, used by all platform-specific play funcs.
  • pkg/tools/mcp listenTCPRetry test helper, used in three places.
  • pkg/tui handlers split into newInteractiveShellCmd + a single execCmd wrapper carrying the only //nolint:noctx (was four).

No behavior change. golangci-lint run ./... and go test ./... are clean.

Adds noctx to the enabled golangci-lint set and threads context through the HTTP, SQL, exec and net APIs it flags.

- Tests use t.Context() with the *Context / WithContext variants.

- Production code passes ctx where it is already in scope, uses context.Background() for genuine background work (DB schema migrations, sqlite Ping at startup, fire-and-forget audio playback) and adds //nolint:noctx for the few intentionally non-context-bound calls (tea.ExecProcess-driven interactive shells/editors and the explicit kill+WaitDelay flow in the shell tool).

While here, factor out the patterns that ended up duplicated:

- pkg/sqliteutil.CheckpointAndClose, used by the three RAG strategy databases.

- pkg/skills.httpGet, used by both cache.go and remote.go.

- pkg/sound.runDetached, used by all platform-specific play funcs.

- pkg/tools/mcp listenTCPRetry test helper, used in three places.

- pkg/tui handlers split into newInteractiveShellCmd + a single execCmd wrapper carrying the only //nolint:noctx (was four).

No behavior change.

Assisted-By: docker-agent
@dgageot dgageot requested a review from a team as a code owner April 25, 2026 18:00
@dgageot dgageot merged commit 6c79176 into docker:main Apr 27, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants