Skip to content

ci: lint, vet and test relay/ as its own module - #14235

Open
ndeloof wants to merge 1 commit into
docker:mainfrom
ndeloof:relay-module-ci
Open

ndeloof wants to merge 1 commit into
docker:mainfrom
ndeloof:relay-module-ci

Conversation

@ndeloof

@ndeloof ndeloof commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

What this PR does, in one sentence

relay/'s Go source now gets vetted, linted, and tested in CI — until now only its container image build was ever validated.

Context

relay/ (github.com/docker/compose-relay) is a separate go.mod, added alongside the network relay feature. Root go vet/golangci-lint/go test never covered it — the local pre-commit hook even carves it out explicitly, precisely because a separate module needs its own invocation. CI's relay-image-cross/relay-image-test only ever checked that the image builds and cross-compiles; the Go source itself had no quality gate.

What this PR brings

  • relay-lint and relay-test bake targets, mirroring the root lint/test Dockerfile stages: a build-base downloading go.mod's dependencies (currently none), a lint stage on the same pinned golangci-lint version as the root, and a test stage running go vet then go test.
  • relay-lint joins the validate bake group; both are new entries in the CI validate matrix job, alongside lint, validate-go-mod, etc.
  • relay/.golangci.yml: its own config, since the lint stage's build context is ./relay only and can't see the root one. Same ruleset as root, minus what a dependency-free module doesn't need (the e2e build tag, testify/gotest.tools-specific depguard entries).
  • 8 real findings turning lint on for the first time surfaced in relay/main.go/main_test.go — unchecked Close() errors, %v instead of %w on a wrapped error, a redundant embedded-field selector, and a log.Fatalf after a defer that would never run. Fixed here so the new job is green from the start rather than merged red.

🤖 Generated with Claude Code

relay/ (github.com/docker/compose-relay) is a separate go.mod: root
`go vet`/`golangci-lint`/`go test` never covered it, and the local
pre-commit hook explicitly excludes any directory with its own go.mod
for the same reason. Only the image build (relay-image-cross) was ever
validated in CI -- the Go source itself had no quality gate.

Adds relay-lint and relay-test bake targets, mirroring the root lint/
test Dockerfile stages: a build-base downloading go.mod's (currently
empty) dependency set, a lint stage running the same pinned
golangci-lint version as the root, and a test stage running go vet
then go test. relay-lint joins the "validate" bake group; both are new
matrix entries in the CI validate job.

relay/ gets its own .golangci.yml (the lint stage's build context is
"./relay" only, so it can't see the root config) with the same rule
set as root, minus what doesn't apply to a dependency-free module
(the e2e build tag, testify/gotest.tools-specific depguard entries).

Turning lint on for the first time surfaced 8 real findings in
relay/main.go and main_test.go (unchecked Close() errors, %v instead
of %w on a wrapped error, a redundant embedded-field selector, and
log.Fatalf after a defer that would never run) -- fixed here so the
new job is green from the start, not merged red.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
@ndeloof
ndeloof requested review from a team as code owners September 16, 2026 18:38
@ndeloof
ndeloof requested a review from glours September 16, 2026 18:38

@docker-agent docker-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assessment: 🟢 APPROVE

@codecov

codecov Bot commented Sep 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants