Skip to content

Keep every image's go.work members present - #11

Merged
teceer merged 1 commit into
mainfrom
fix/docker-images-match-the-workspace
Aug 6, 2026
Merged

teceer merged 1 commit into
mainfrom
fix/docker-images-match-the-workspace

Conversation

@teceer

@teceer teceer commented Aug 6, 2026

Copy link
Copy Markdown
Owner

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.work is loaded before anything compiles, so a member the build context cannot open is a hard error even when nothing imports it:

go: cannot load module ../world-gateway listed in go.work file:
    open ../world-gateway/go.mod: no such file or directory

The workspace has grown twice since these Dockerfiles were written, and each growth broke images silently:

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.work silently 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:

  • build the images in CI (catches it, costs minutes per run)
  • generate the manifest-copy block from go.work instead of hand-listing it

Test plan

  • docker build for services/bank, services/world-gateway, services/workplaces/farm — all three succeed. Before this change, bank failed outright with the error above.
  • No source changes; the Go code is untouched.

🤖 Generated with Claude Code

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.
@teceer
teceer merged commit 53fb6fc into main Aug 6, 2026
17 of 21 checks passed
@teceer
teceer deleted the fix/docker-images-match-the-workspace branch August 6, 2026 16:16
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.

1 participant