ci: unblock golangci-lint on Go 1.26 and clear all lint findings#5
Merged
Conversation
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>
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.
See the commit message for full detail.
Summary
golangci-lint-actionfrom v2.7.0 (panics type-checking Go 1.26 deps) to v2.12.2 (built with Go 1.26), drops thecontinue-on-errorworkaround and the.golangci.ymlrun.go: "1.25"hack so lint gates green again.fmt.Fprint*/tabwriter.Flushoutput-write family (never actionable in a CLI); explicitlydefer func() { _ = …Close() }()-wraps resource handles (output-filef.Close,resp.Body.Close) and_ =sMarkFlagRequired/os.Remove/exec.Cmd.Start.WriteString(fmt.Sprintf(…))→fmt.Fprintf(&sb, …)in the network/storage fix writers (QF1012), drops a needlessfmt.Sprintf(S1039), and fixes an error-string punctuation case (ST1005).mockIAMProviderfromaudit/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, andtask buildall 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
gcpandazuretopics.