lint: fix all 24 goconst findings (repeated string literals) #178
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Surveyed 2026-08-07: golangci-lint 2.12.2 reports 24
goconstfindings on
main— repeated string literals that should be namedconstants. Breakdown:
Production code (10):
internal/handlers/app.go:error(14×),App(8×),status(6×),
Error(5×),logs(4×)internal/handlers/webhook_events.go:App(8×)internal/handlers/setup.go:Error(5×)internal/handlers/api.go:error(14×)Test code (14):
internal/service/app/app_test.go: repo URL fixtures (2 findings)internal/service/webhook/webhook_test.go:main,X-Gitea-Event,X-GitHub-Event,Push Hook(4 findings)internal/middleware/realip_test.go: IP fixtures (6 findings)internal/middleware/ratelimit_test.go:10.0.0.1:1234(1 finding)internal/handlers/handlers_test.go:secret,main(2 findings)internal/docker/validation_test.go:main(1 finding)Remediation: extract package-level (or test-file-level) constants with
meaningful names — e.g. template data keys (
App,Error) inhandlers, header names and branch fixtures in tests. Where the same
literal appears in both
app.goandapi.go/webhook_events.go,share one constant in the
handlerspackage rather than duplicating.Definition of done:
make lint(golangci-lint ≥ 2.12) reports zerogoconstfindings//nolintdirectives added; no behavior changemake testpasses;make fmtrun before commitTODO.mdupdated per the repo workflowmain