Conversation
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>
docker-agent
left a comment
Contributor
There was a problem hiding this comment.
Assessment: 🟢 APPROVE
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
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. Rootgo vet/golangci-lint/go testnever covered it — the local pre-commit hook even carves it out explicitly, precisely because a separate module needs its own invocation. CI'srelay-image-cross/relay-image-testonly ever checked that the image builds and cross-compiles; the Go source itself had no quality gate.What this PR brings
relay-lintandrelay-testbake targets, mirroring the rootlint/testDockerfile stages: abuild-basedownloadinggo.mod's dependencies (currently none), alintstage on the same pinnedgolangci-lintversion as the root, and ateststage runninggo vetthengo test.relay-lintjoins thevalidatebake group; both are new entries in the CIvalidatematrix job, alongsidelint,validate-go-mod, etc.relay/.golangci.yml: its own config, since the lint stage's build context is./relayonly and can't see the root one. Same ruleset as root, minus what a dependency-free module doesn't need (thee2ebuild tag, testify/gotest.tools-specificdepguardentries).relay/main.go/main_test.go— uncheckedClose()errors,%vinstead of%won a wrapped error, a redundant embedded-field selector, and alog.Fatalfafter adeferthat would never run. Fixed here so the new job is green from the start rather than merged red.🤖 Generated with Claude Code