Add golangci-lint to codebase & CI#96
Merged
Merged
Conversation
Adds .golangci.yml (v2, standard preset + bodyclose/gocritic/misspell/unconvert/unparam/nolintlint), a lint job in ci.yaml, and a just lint recipe. Fixes all 91 issues reported by the enabled linters across 36 files. errcheck (312) and revive (578) are disabled pending dedicated cleanup PRs.
Bump action to v7, pin to v2.12.2, and move exclude-rules to linters.exclusions.rules per the v2 config schema.
…, so the error return was dead code. Drop it, simplify the caller, and clean up the now-unused imports.
…ves two gocritic suppressions: collapses the defer/os.Exit pattern in Execute() and eliminates defer-in-loop in pollForResult().
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.
Problem
Currently, this Go codebase doesn't support a
.golangci-lintconfiguration, and there's no validation for lint violations in CI.Solution
Adds .golangci.yml (v2, standard preset + bodyclose/gocritic/misspell/unconvert/unparam/nolintlint), a lint job in ci.yaml, and a just lint recipe. Fixes all 91 issues reported by the enabled linters across 36 files. errcheck (312) and revive (578) are disabled pending dedicated cleanup PRs.
Type of Change
Test Plan
Note
Low Risk
Mostly style and CI; login session cleanup and root cancel timing are small behavioral changes in auth/shutdown paths but align with clearer lifecycle handling.
Overview
Adds golangci-lint to the repo: new
.golangci.yml(v2, standard preset plus bodyclose, gocritic, misspell, unconvert, unparam, nolintlint; errcheck and revive left off for follow-up PRs), alintjob in GitHub Actions, and ajust lintrecipe.The rest of the diff is mechanical fixes so the enabled linters pass (~91 issues across ~36 files): octal file modes (
0o755/0o600),switchinstead of if/else chains, named return values on mocks, combined string params, lowercasefmt.Errorfstrings,http.NoBody,bodyclosein tests, and small refactors (e.g.config listno longer returns an error fromrunListCmd).Behavioral tweaks worth noting: OAuth session cleanup in
pollForResultruns explicitly on each exit path instead of a singledefer; rootExecutecallscancel()after the command finishes rather thandefer cancel()at entry.Reviewed by Cursor Bugbot for commit 2705f92. Bugbot is set up for automated code reviews on this repo. Configure here.