Background
lint.yml was workflow_dispatch-only before #2 , so golangci-lint never
actually ran automatically in CI against this codebase. Wiring it to run on
push/PR (#2 ) surfaced 42 pre-existing findings on main, unrelated to any
in-flight feature work. Tracking here so they can be cleaned up as a
dedicated PR rather than mixed into feature branches.
Reference run: https://github.com/InterWorks/typesense-operator/actions/runs/33202281929/job/98954432885
Findings by linter
gocyclo (4) — functions over the complexity-30 threshold:
internal/controller/typesensecluster_controller.go:117 Reconcile (37)
internal/controller/typesensecluster_httproute.go:24 ReconcileHttpRoute (33)
internal/controller/typesensecluster_ingress.go:60 ReconcileIngress (53)
internal/controller/typesensecluster_quorum.go:25 ReconcileQuorum (39)
staticcheck (14) :
typesensecluster_configmap.go:179,328,338 — remove embedded Client from selector (QF1008)
typesensecluster_configmap.go:273 — ineffective break in nested loop, may not break outer loop as intended (SA4011)
typesensecluster_httproute.go:73,148 — assigned httpRoute value never used (SA4006)
typesensecluster_httproute.go:283 — remove embedded CommonRouteSpec from selector (QF1008)
typesensecluster_ingress.go:646,647,649 — remove embedded ObjectMeta from selector (QF1008)
typesensecluster_quorum.go:146 — use strings.ReplaceAll instead of strings.Replace(..., -1) (QF1004)
utils.go:237 (internal/controller) — remove embedded VolumeSource from selector (QF1008)
test/utils/utils.go:25 — dot import (ST1001)
test/utils/utils.go:138 — use strings.ReplaceAll (QF1004)
unused (5) :
typesensecluster_quorum_helpers.go:227 getHealthyReadLagThreshold unused
internal/controller/utils.go:35 generateSecureRandomString unused
internal/controller/utils.go:203-207 minDelayPerReplicaFactor, maxDelayPerReplicaFactor, getDelayPerReplicaFactor unused
unparam (4) — unused first return value:
typesensecluster_configmap.go:92 updateConfigMap (*v1.ConfigMap)
typesensecluster_httproute.go:345 createReferenceGrant (*ReferenceGrant)
typesensecluster_services.go:160 createService (*v1.Service)
internal/controller/utils.go:218 contains (int)
revive (3) — api/v1alpha1/typesensecluster_types_httproute.go:30-32 comment-spacing (//// +optional etc. need a space after //)
nakedret (3) — typesensecluster_quorum_helpers.go:260,269,295 naked returns in getHealthyLagThresholds (41 lines, over the naked-return line limit)
errcheck (2) — unchecked resp.Body.Close():
typesensecluster_quorum_helpers.go:45
typesensecluster_quorum_helpers.go:131
goimports (2) — files not properly formatted:
typesensecluster_quorum_types.go:4
typesensecluster_secret.go:5
ineffassign (2) — typesensecluster_quorum.go:334,336 assignments to conditionReason/conditionStatus never read
misspell (1) — typesensecluster_quorum.go:109 commited → committed
prealloc (1) — typesensecluster_ingress.go:401 var filters []string could be pre-allocated
unconvert (1) — typesensecluster_quorum_helpers.go:192 unnecessary type conversion
Acceptance criteria
make lint passes clean with no exemptions added beyond what's already in .golangci.yml
No behavior change — this is lint-only cleanup (verify with make test / make test-e2e)
Background
lint.ymlwasworkflow_dispatch-only before #2, sogolangci-lintneveractually ran automatically in CI against this codebase. Wiring it to run on
push/PR (#2) surfaced 42 pre-existing findings on
main, unrelated to anyin-flight feature work. Tracking here so they can be cleaned up as a
dedicated PR rather than mixed into feature branches.
Reference run: https://github.com/InterWorks/typesense-operator/actions/runs/33202281929/job/98954432885
Findings by linter
internal/controller/typesensecluster_controller.go:117Reconcile(37)internal/controller/typesensecluster_httproute.go:24ReconcileHttpRoute(33)internal/controller/typesensecluster_ingress.go:60ReconcileIngress(53)internal/controller/typesensecluster_quorum.go:25ReconcileQuorum(39)typesensecluster_configmap.go:179,328,338— remove embeddedClientfrom selector (QF1008)typesensecluster_configmap.go:273— ineffectivebreakin nested loop, may not break outer loop as intended (SA4011)typesensecluster_httproute.go:73,148— assignedhttpRoutevalue never used (SA4006)typesensecluster_httproute.go:283— remove embeddedCommonRouteSpecfrom selector (QF1008)typesensecluster_ingress.go:646,647,649— remove embeddedObjectMetafrom selector (QF1008)typesensecluster_quorum.go:146— usestrings.ReplaceAllinstead ofstrings.Replace(..., -1)(QF1004)utils.go:237(internal/controller) — remove embeddedVolumeSourcefrom selector (QF1008)test/utils/utils.go:25— dot import (ST1001)test/utils/utils.go:138— usestrings.ReplaceAll(QF1004)typesensecluster_quorum_helpers.go:227getHealthyReadLagThresholdunusedinternal/controller/utils.go:35generateSecureRandomStringunusedinternal/controller/utils.go:203-207minDelayPerReplicaFactor,maxDelayPerReplicaFactor,getDelayPerReplicaFactorunusedtypesensecluster_configmap.go:92updateConfigMap(*v1.ConfigMap)typesensecluster_httproute.go:345createReferenceGrant(*ReferenceGrant)typesensecluster_services.go:160createService(*v1.Service)internal/controller/utils.go:218contains(int)api/v1alpha1/typesensecluster_types_httproute.go:30-32comment-spacing (//// +optionaletc. need a space after//)typesensecluster_quorum_helpers.go:260,269,295naked returns ingetHealthyLagThresholds(41 lines, over the naked-return line limit)resp.Body.Close():typesensecluster_quorum_helpers.go:45typesensecluster_quorum_helpers.go:131typesensecluster_quorum_types.go:4typesensecluster_secret.go:5typesensecluster_quorum.go:334,336assignments toconditionReason/conditionStatusnever readtypesensecluster_quorum.go:109commited→committedtypesensecluster_ingress.go:401var filters []stringcould be pre-allocatedtypesensecluster_quorum_helpers.go:192unnecessary type conversionAcceptance criteria
make lintpasses clean with no exemptions added beyond what's already in.golangci.ymlmake test/make test-e2e)