Repository navigation
Keep every image's go.work members present - #11
Merged
Merged
Conversation
None of the three Go images could be built. `go.work` is loaded before
anything compiles, so a member the build context cannot open is a hard
error even when nothing imports it — and the workspace has grown twice
since these files were written:
go: cannot load module ../world-gateway listed in go.work file:
open ../world-gateway/go.mod: no such file or directory
`bank` (#4) never copied gotel, world-gateway, farm or conformance, so
the image has never built at all. `world-gateway` and `farm` never
copied bank. The gotel lines were already staged locally against #3 and
are folded in here.
Each image now copies the manifest of every workspace member, and the
sources only of what it actually builds. Manifests are a few kilobytes
and they keep the layer cache split the way it was intended — sources
still arrive after `go mod download`.
This is a recurring failure rather than three coincidences: adding a
module to go.work silently breaks every image that does not list it,
and nothing in CI builds these, so it surfaces at deploy time. Verified
by building all three locally.
4 of 5 tasks
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.
None of the three Go images could be built. I found this while checking two uncommitted Dockerfile edits sitting in the working tree, and the problem turned out to be larger than those edits.
Why
go.workis loaded before anything compiles, so a member the build context cannot open is a hard error even when nothing imports it:The workspace has grown twice since these Dockerfiles were written, and each growth broke images silently:
bankhas never built. It was added in Work pays money, and the ledger is a service (ADR 0006) #4 and copies onlygen/goand itself — notgotel,world-gateway,farmorconformance. The image has never been produced successfully.world-gatewayandfarmnever copiedbank, so Work pays money, and the ledger is a service (ADR 0006) #4 broke them too.gotellines (from feat(observability): grafana/otel-lgtm, tracing across every hop, business metrics #3) were already sitting uncommitted in the working tree; they are folded in here rather than left as a loose local edit.The fix
Each image copies the manifest of every workspace member, and the sources only of what it actually builds. Manifests are a few kilobytes, and keeping them in the early layer preserves the cache split these files were designed around — sources still arrive after
go mod download.Worth noticing
This is a recurring failure mode, not three coincidences. Adding a module to
go.worksilently breaks every image that does not list it, and nothing in CI builds these images, so it surfaces at deploy time — which is exactly where the "image builds for all four services" wait that was hanging around earlier would have run into it.Two ways to stop it recurring, neither done here because both are their own decision:
go.workinstead of hand-listing itTest plan
docker buildforservices/bank,services/world-gateway,services/workplaces/farm— all three succeed. Before this change,bankfailed outright with the error above.🤖 Generated with Claude Code