lint: enable noctx and deduplicate touched code#2508
Open
dgageot wants to merge 1 commit intodocker:mainfrom
Open
lint: enable noctx and deduplicate touched code#2508dgageot wants to merge 1 commit intodocker:mainfrom
dgageot wants to merge 1 commit intodocker:mainfrom
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
noctxto the enabled golangci-lint set and threads context through the HTTP, SQL, exec and net APIs it flags.t.Context()with the*Context/WithContextvariants.ctxwhere it is already in scope, usescontext.Background()for genuine background work (DB schema migrations, sqlitePingat startup, fire-and-forget audio playback) and adds//nolint:noctxfor the few intentionally non-context-bound calls (tea.ExecProcess-driven interactive shells/editors and the explicit kill+WaitDelayflow 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 bothcache.goandremote.go.pkg/sound.runDetached, used by all platform-specific play funcs.pkg/tools/mcplistenTCPRetrytest helper, used in three places.pkg/tuihandlers split intonewInteractiveShellCmd+ a singleexecCmdwrapper carrying the only//nolint:noctx(was four).No behavior change.
golangci-lint run ./...andgo test ./...are clean.