Skip to content

Fix golangci-lint failures (236 issues) #80

Closed

Description

@David-Noble-at-work

Summary

Pre-commit checks fail with 236 linting issues from golangci-lint. These are pre-existing issues that need systematic cleanup.

Issue Breakdown

Category Count Description
errcheck 50 Unchecked error returns
revive 50 Missing comments on exported types
gocritic 50 Code quality suggestions
gocognit 23 Cognitive complexity too high
nilerr 19 Returning nil when error is set
gosec 16 Security issues
unparam 11 Unused parameters
errorlint 6 Error wrapping issues
staticcheck 4 Static analysis findings
noctx 3 HTTP requests without context
misspell 2 Spelling errors
gocyclo 1 Cyclomatic complexity
unused 1 Unused function

Priority Categories

High Priority (Security/Correctness)

gosec (16) - Security issues:

  • Hardcoded credentials
  • Insecure file permissions
  • Potential command injection

errcheck (50) - Unchecked errors:

nilerr (19) - Returning nil with error:

  • Functions that check if err != nil but return nil, nil
  • May mask failures

noctx (3) - HTTP without context:

  • HTTP requests that can't be cancelled
  • Should use http.NewRequestWithContext

Medium Priority (Code Quality)

gocognit (23) / gocyclo (1) - Complexity:

  • Functions too complex to reason about
  • Should be refactored into smaller pieces

staticcheck (4) - Static analysis:

  • Unused append results
  • Nil context passed to functions

unparam (11) - Unused parameters:

  • Dead code or incomplete implementations

unused (1) - Unused function:

  • extractNodeID in internal/starlark/plan.go

Low Priority (Style)

revive (50) - Missing comments:

  • Exported types/methods without documentation
  • Can be batch-fixed

gocritic (50) - Code suggestions:

  • elseif → else if
  • Unnecessary type conversions
  • Style improvements

errorlint (6) - Error wrapping:

  • Should use errors.Is/errors.As
  • Should use %w for wrapping

misspell (2) - Spelling:

  • "Decommision" → "Decommission"

Files with Most Issues

Based on the lint output, high-issue files include:

  • internal/execution/ops_service.go - Many exported methods without comments
  • internal/console/*.go - Unchecked fmt errors
  • internal/starlark/*.go - Complex functions, unchecked errors
  • internal/bindgen/cobra/extractor.go - Many unchecked errors

Approach

  1. Immediate: Fix gosec and nilerr issues (correctness)
  2. Short-term: Fix errcheck for security-sensitive operations
  3. Ongoing: Add comments to exported types as code is touched
  4. Refactor: Break down high-complexity functions

Related Issues

Commands

Run lint check:

pre-commit run golangci-lint --all-files

Run specific linter:

golangci-lint run --enable=errcheck ./...
golangci-lint run --enable=gosec ./...

Activity

  1. David-Noble-at-work commented on Aug 7, 2026

    @David-Noble-at-work
    ContributorAuthor

    Closing as addressed by the lint ladder: the true uncapped count was 2,486 findings; it reached zero across PRs #290–#320, every surviving suppression carries a stated reason, and CI enforces board zero (PR #321 fixed the gate's verdict; #328 pinned golangci v2.12.2).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions