Repository navigation
fix(retention): clear the lint findings in the retention plugin - #109
Merged
Merged
Conversation
golangci-lint reports ten findings in plugins/retention on main, which fails the Lint job on every open PR regardless of what that PR touches. Worth knowing that CI's output understates the problem. golangci-lint defaults to max-same-issues: 3, so it printed three bodyclose findings where there were twenty-two. Fixing only the named lines surfaces the next three. What changed: bodyclose, 22 sites. fakeResp builds a synthetic *http.Response for classifyHTTPError to inspect. It has no Body, because classification reads only the status and headers and nothing came from a real transport. The linter flags the call sites because the function returns *http.Response, so they carry a directive; closing a nil Body would panic. The reasoning lives on fakeResp itself rather than being repeated at each site. errcheck, store_models.go. Job.Payload is a map[string]string, which has no channel, func or cyclic value that could make json.Marshal fail. Documented rather than given an error path that can never run. If Payload ever holds something richer, this needs revisiting. govet shadow, provider_hubspot.go. The inner err in the PATCH branch shadowed the one from findContactByEmail; renamed to patchErr. revive unused-parameter, 6 handlers. Renamed r to _ where the handler ignores the request. Only those; the other handlers in these files do read r. unparam, consent_test.go. Every caller passed purpose as "marketing", so the parameter carried no information. Dropped it and bound the value as a local const. Take a parameter again if a test needs a second purpose. unused, provider_generic.go. Dropped the classifierPolicyDecided constant, which no longer gated anything, and kept its rationale as a comment. The point it makes is worth keeping: an unwritten retry policy that only surfaced at the first CRM error would decide by accident whether a transient 503 permanently drops a customer's sync. Full-repo lint is clean and all 98 packages pass.
This was referenced Sep 6, 2026
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.
golangci-lintreports ten findings inplugins/retentiononmain, whichfails the
ci / Lintjob on every open PR regardless of what that PR touches.It is currently red on #108, whose diff is three files and none of them here.
CI's output understates the problem
golangci-lint defaults to
max-same-issues: 3, so it printed threebodyclosefindings where there were twenty-two. Fixing only the named lines surfaces
the next three. Worth knowing before trusting a pasted lint list as complete.
What changed
bodyclose, 22 sites.
fakeRespbuilds a synthetic*http.ResponseforclassifyHTTPErrorto inspect. It has no Body: classification reads only thestatus and headers, and nothing came from a real transport. The linter flags
the call sites because the function returns
*http.Response, so they carry adirective; closing a nil Body would panic. The reasoning sits on
fakeRespitself rather than being repeated 22 times.
errcheck,
store_models.go.Job.Payloadis amap[string]string, whichhas no channel, func or cyclic value that could make
json.Marshalfail.Documented rather than given an error path that can never run.
govet shadow,
provider_hubspot.go. The innererrin the PATCH branchshadowed the one from
findContactByEmail; renamed topatchErr.revive unused-parameter, 6 handlers. Renamed
rto_where the handlerignores the request — only those. The other handlers in these files do read
r, and renaming them all breaks compilation.unparam,
consent_test.go. Every caller passedpurposeas"marketing",so the parameter carried no information. Dropped, with the value bound as a
local const.
unused,
provider_generic.go. DroppedclassifierPolicyDecided, which nolonger gated anything, and kept its rationale as a comment. The point it makes
is worth keeping: an unwritten retry policy that only surfaced at the first CRM
error would decide by accident whether a transient 503 permanently drops a
customer's sync.
Verification
Full-repo
golangci-lint run ./...on CI's exact version (2.12.2): 0 issues.All 98 packages build and test clean.
Merging this should turn
ci / Lintgreen on #108 and anything else currentlyopen.