chore(lint): address pre-existing lint debt surfaced by golangci-lint v2.12.1 bump
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 64/100
Research direction
Start with the v2.12.1 CI output, .golangci.yml, and .github/workflows/ci.yml, then inspect the listed production and test files for goconst and modernize findings. Check existing seiv1alpha1 constants and the k8s.io/utils/ptr usage before changing helpers. Done means the full v2.12.1 run passes without only-new-issues, with no new //nolint directives or behavior changes.
Written by the indexing model from the issue text.
Description
Problem
PR #162 forced a bump of golangci-lint from v2.8.0 → v2.12.1 because the seictl v0.0.37 module dragged go.mod's go directive to 1.26.0 (seictl declares go 1.26.0 as a minimum), and v2.8.0 was built with go1.25 and refuses to lint a 1.26 module.
The newer linter surfaces ~50 pre-existing issues spanning the codebase. None of them are introduced by #162's diff — they are pre-existing tech debt newly visible.
To unblock #162, the workflow runs with only-new-issues: true so the diff itself is gated but the debt isn't surfaced as a blocker on every PR. This issue tracks paying that debt down.
Surface
Counts from the v2.12.1 run on commit 3a80a53:
-
34 × goconst — repeated string literals flagged for extraction. Two buckets:
- Generic K8s field names:
"name","namespace","port","action","targetLabel","data","start","true". These appear 3-6 times each in CRD / PrometheusRule / Service / pod-spec construction. Extracting these to constants is worse —const namespaceField = "namespace"adds confusion, not clarity. Right fix: bump goconst'smin-occurrencesthreshold to 5 (or higher) in.golangci.ymlso it stops flagging field names that just happen to recur. - Domain identifiers:
"rpc","validator","archive","exporter","replayer","evm","grpc","seid","sei.io/nodedeployment","chain". These are legitimate constants. Some likely already exist as exported constants somewhere in the codebase (e.g.,seiv1alpha1.RoleValidator?) — should be re-used rather than duplicated.
- Generic K8s field names:
-
16 × modernize (
newexpr) —strPtr(x)/boolPtr(x)/int32Ptr(x)/To(x)calls and helper-fn definitions. Mechanical fixes:- At call sites:
strPtr("foo")→func() *string { v := "foo"; return &v }()is wordy; usually the right move is to replace the helper withptr.To(...)fromk8s.io/utils/ptr(orpointer.String(...)fromk8s.io/utils/pointer). Some call sites with zero-value args (strPtr("")) genuinely simplify tonew(string). - At helper definitions (
internal/controller/node/plan_execution_test.go:89definesstrPtr, etc.): replace withptr.Toimport.
- At call sites:
-
1 × other — single residual flagged as
(true)linter; likely revive'sbool-literal-in-expror similar. Easy.
Affected files (from CI log)
Production:
internal/controller/nodedeployment/{internal_service,monitoring,networking,nodes,per_pod_services}.gointernal/noderesource/noderesource.gointernal/task/bootstrap_resources.go
Tests:
internal/controller/node/{import_pvc,peers,plan_execution,reconciler,sidecar_probe_integration,plan_execution_integration}_test.gointernal/controller/nodedeployment/{internal_service,plan}_test.gointernal/planner/executor_test.gointernal/task/observe_image_test.go
Impact
Low-severity debt. The code works. The lint failure was a CI artifact of the linter version bump, not a regression in behavior.
Worth addressing because:
only-new-issues: trueis a workaround that masks future debt accumulation in untouched files. A reader can introduce identical patterns to the existing-but-suppressed issues and the linter won't flag them as long as they don't appear in the PR diff.goconstandmodernizeare both legitimately useful when calibrated. Tuning them once produces ongoing value.
Proposed approach
.golangci.ymlcalibration — bumpgoconst.min-occurrencesto 5 (silences generic-field-name noise). Keep the linter enabled for cases that genuinely warrant constants.- Extract real constants for the domain identifiers in
monitoring.go,networking.go,nodedeployment/*.go. Search first —seiv1alpha1may already export some of these. modernizefixes — replace localstrPtr/boolPtr/int32Ptrhelpers withk8s.io/utils/ptr.To[T](a generic that subsumes all three). Drop the helpers. Mechanical 1-line-per-site replacement.- Remove
only-new-issues: truefrom.github/workflows/ci.ymlonce the run is clean.
Estimated time: 30-45 min focused work. Could be one PR or split if the goconst constant extractions need code review.
Acceptance criteria
-
golangci-lint v2.12.1run onmainexits 0 withoutonly-new-issues: true. -
.golangci.ymlis the only place that suppresses linter rules; no in-source//nolintdirectives added. - No behavior change — purely lint cleanup.
Out of scope
- Bumping golangci-lint past v2.12.1 (latest as of filing). Future bumps may surface new rules; address those when they happen.
- Migrating to a different linter framework or adding new linters.
- The follow-up #161 work (drop
taskParamser) — different concern, separate workstream.
References
- #162 introduced the version bump that surfaced this debt
internal/task/sidecar.go:22-37— example of the_ taskParamserassertion block style; consider matching that for any other typed-interface assertions added during cleanup- golangci-lint goconst settings: https://golangci-lint.run/usage/linters/#goconst
k8s.io/utils/ptrfor the modernize helper replacement: https://pkg.go.dev/k8s.io/utils/ptr
🤖 Generated with Claude Code
- Dominant language
- Go
- Stars
- 1
- Forks
- 2
- Avg merge
- 2h 29m
- Merged PRs (30d)
- 56
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sei-protocol/sei-k8s-controller
-
Difficulty 5/5 Over a week Newbie friendliness 32/100
-
Difficulty 5/5 Over a week Newbie friendliness 32/100
sei-protocol/sei-k8s-controller#457 · 2 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Difficulty 3/5 1-2 days Newbie friendliness 65/100
All issues in sei-protocol/sei-k8s-controller
Similar issues
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
blinklabs-io/bursa#904 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
yanet-platform/ipfw-go#129 ·
-
bug confmap/provider/googlesecretmanagerprovider needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
open-telemetry/opentelemetry-collector-contrib#51273 · 2 comments ·
-
bug: AI Gateway client filter lists "Unknown" twice when NULL and literal Unknown clients coexist Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100