Skip to content

ci: unblock golangci-lint on Go 1.26 and clear all lint findings#5

Merged
stxkxs merged 1 commit into
mainfrom
fix-ci-lint
May 29, 2026
Merged

ci: unblock golangci-lint on Go 1.26 and clear all lint findings#5
stxkxs merged 1 commit into
mainfrom
fix-ci-lint

Conversation

@stxkxs
Copy link
Copy Markdown
Member

@stxkxs stxkxs commented May 29, 2026

See the commit message for full detail.

Summary

  • Unblocks the lint job: bumps golangci-lint-action from v2.7.0 (panics type-checking Go 1.26 deps) to v2.12.2 (built with Go 1.26), drops the continue-on-error workaround and the .golangci.yml run.go: "1.25" hack so lint gates green again.
  • errcheck: config-excludes the fmt.Fprint* / tabwriter.Flush output-write family (never actionable in a CLI); explicitly defer func() { _ = …Close() }()-wraps resource handles (output-file f.Close, resp.Body.Close) and _ =s MarkFlagRequired / os.Remove / exec.Cmd.Start.
  • staticcheck: WriteString(fmt.Sprintf(…))fmt.Fprintf(&sb, …) in the network/storage fix writers (QF1012), drops a needless fmt.Sprintf (S1039), and fixes an error-string punctuation case (ST1005).
  • unused: removes the dead mockIAMProvider from audit/runner_test.go.

Verification

golangci-lint v2.12.2 (the pinned CI version), run with caps disabled, reports 0 issues. go build, go test ./..., go vet, and task build all pass.

Out-of-tree (already applied via gh)

The GitHub repo description and topics were updated to drop GCP/Azure: description → "AWS security & cost CLI — …, plus a Kubernetes RBAC scanner"; removed the gcp and azure topics.

The CI lint job was failing: it pinned golangci-lint v2.7.0, which is
built with Go 1.25 and panics type-checking this module's Go 1.26
dependencies (k8s.io/client-go et al). It ran under continue-on-error,
so it showed red without gating. A Go 1.26-built release now exists
(v2.11.x / v2.12.x), so this unblocks it properly and makes lint gate
green.

─── CI / config ───

- .github/workflows/ci.yml: bump the golangci/golangci-lint-action pin
  from v2.7.0 to v2.12.2 (built with Go 1.26, type-checks the module's
  go 1.26 deps without panicking) and drop the continue-on-error
  workaround so the lint job gates again.
- .golangci.yml: remove the obsolete run.go: "1.25" downgrade hack — the
  new binary reads go 1.26 from go.mod fine. Add an errcheck
  exclude-functions policy for the fmt.Fprint* family and
  (*text/tabwriter.Writer).Flush: writes to stdout/stderr/tabwriter/
  strings.Builder never carry an actionable error in a CLI. Resource
  handles stay checked.

─── errcheck — resource handles, explicit ───

- Deferred Close calls wrapped as `defer func() { _ = x.Close() }()`: the
  output-file f.Close() in every report-writing command (audit, certs,
  compare, compliance, cost, drift, iam, inventory, lambda, network,
  orphans, quota, secrets, storage, tags) and out.Close() in report.go;
  resp.Body.Close() in the slack / webhook / pagerduty sinks.
- `_ =` on cobra MarkFlagRequired (baseline, report), os.Remove
  (baseline/store.go temp cleanup), and the exec.Cmd.Start() browser-open
  in report.go.

─── staticcheck ───

- QF1012: convert sb.WriteString(fmt.Sprintf(...)) to fmt.Fprintf(&sb, …)
  throughout internal/network/fix.go and internal/storage/fix.go.
- S1039: drop an unnecessary fmt.Sprintf (no verbs) in storage/fix.go.
- ST1005: remove trailing punctuation from an error string in
  internal/output/sinks/sinks.go.

─── unused ───

- Remove the dead mockIAMProvider type and its six methods from
  internal/audit/runner_test.go (nothing referenced it).

Verification: golangci-lint v2.12.2 (the pinned CI version), run with
caps disabled (--max-same-issues 0 --max-issues-per-linter 0), reports
0 issues. go build ./..., go test ./..., go vet ./..., and task build
all pass.

Co-authored-by: stxkxsbot <275011021+stxkxsbot@users.noreply.github.com>
@stxkxs stxkxs marked this pull request as ready for review May 29, 2026 17:09
@stxkxs stxkxs merged commit 1de58ce into main May 29, 2026
4 checks passed
@stxkxs stxkxs deleted the fix-ci-lint branch May 29, 2026 17:09
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.

1 participant