ci: run golangci-lint on the Caddy module#2397
Merged
Conversation
Adds a second golangci-lint step scoped to caddy/ on the same job as the root lint. Fixes the pre-existing issues that surfaced: - admin.go: propagate the success() error instead of dropping it - admin_test.go: assert resp.Body.Close() with require.NoError - app.go: rename iniError to errIni (ST1012) - mercure.go: lowercase the leading article in error strings (ST1005)
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enables golangci-lint for the Go submodule under caddy/ in CI and fixes the lint violations that surfaced, bringing the Caddy module’s Go code under the same linting expectations as the repo root module.
Changes:
- Add a dedicated
golangci-lintCI step that runs in thecaddy/module directory (gated to PHP 8.5 like the existing Go lint step). - Fix lint findings in the Caddy module: propagate a previously ignored error, adjust test cleanup to check
Close()errors, and apply small naming / error-string style corrections.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/tests.yaml |
Adds a CI lint step to run golangci-lint within the caddy/ module. |
caddy/admin.go |
Returns the admin.success(...) error instead of discarding it. |
caddy/admin_test.go |
Ensures resp.Body.Close() is checked so close failures are reported by tests. |
caddy/app.go |
Renames a package error var to satisfy Go naming lint rules. |
caddy/mercure.go |
Adjusts error strings to match Go error-string style (lowercase). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Kévin Dunglas <kevin@dunglas.fr>
alexandre-daubois
approved these changes
May 7, 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.
Summary
The Caddy module under
caddy/has its owngo.modand was never linted by CI. Enabling lint surfaced a handful of real issues; this PR fixes them and wires the linter in.Workflow
Adds a second
golangci/golangci-lint-action@v9step withworking-directory: caddy, gated onmatrix.php-versions == '8.5'(same as the existing root lint).Fixes
caddy/admin.go:restartWorkersdiscarded the error fromadmin.success. Now returned.caddy/admin_test.go:defer resp.Body.Close()(errcheck). Switched todefer func() { require.NoError(t, resp.Body.Close()) }()so a real failure surfaces.caddy/app.go:var iniErrorrenamed toerrIni(ST1012).caddy/mercure.go: lowercase leading article in two error strings (ST1005).Lint passes on both modules with the CI build tags
nobadger,nomysql,nopgx.