build: keep replaced plugin modules in the require graph#5682
Merged
norman-abramovitz merged 2 commits intoJul 22, 2026
Conversation
The local plugin modules with their own go.mod (cfapppush, kubernetes, monocular) are imported only by extra_plugins.go, which is generated from plugin-config.yaml and gitignored so each deployment picks its own plugin set. On any checkout where generation has not run — dependabot, a fresh clone, an IDE before `go generate` — `go mod tidy` cannot see those imports, prunes their require lines while the replace directives remain, and fails every backend build with "replaced but not required". Add a `//go:build tools` keep-file that blank-imports those three modules to pin their requires regardless of extra_plugins.go. It is never compiled into the binary; what a deployment runs is still controlled solely by the gitignored extra_plugins.go.
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
Add
src/jetstream/plugins_keep.go, a//go:build toolsfile thatblank-imports the three local plugin modules that have their own
go.modand a
replacedirective:cfapppush,kubernetes(andkubernetes/authtransitively), and
monocular.Why
Those modules are otherwise imported only by
extra_plugins.go, which isgenerated from
plugin-config.yamland gitignored so each deployment canchoose its own plugin set. On any checkout where generation has not run —
Dependabot, a fresh clone, an IDE before
go generate—go mod tidycannotsee those imports, prunes their
requirelines while thereplacedirectivesremain, and fails every backend build with:
This is why every Go Dependabot PR has been failing the backend build.
How this changes file production
The module graph is no longer produced solely from the generated,
deployment-specific
extra_plugins.go. The keep-file pins those requiresindependently, so
go mod tidyyields a consistentgo.modwhether or notgeneration has run.
extra_plugins.gostays gitignored and remains the onlything that controls what a deployment actually compiles in — the keep-file is
excluded from every normal build by its
toolstag.Effect on operators
no change. The shipped binary is identical; the keep-file is never compiled
in.
go mod tidyno longer break. Selecting a plugin subset via
plugin-config.yaml/extra_plugins.goworks exactly as before.a fork must also drop that import from
plugins_keep.go.Verification
extra_plugins.go,go mod tidy, build):build passes,
go.modbyte-identical to committed.go build ./...(normal) unaffected; keep-file excluded by thetoolstag.