generator/gomod: support GOPROXY build arg#1141
Open
kartikjoshi21 wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds support for injecting a custom Go module proxy into Dalec’s gomod generator flow via a frontend build arg, allowing module downloads (including during gomod patch preprocessing) to use a user-supplied GOPROXY without requiring anything in the spec file.
Changes:
- Introduces
DALEC_GOMOD_PROXYas a known frontend build arg and threads it intoSourceOpts(GomodProxy). - Applies the proxy override to gomod dependency download execution and gomod patch preprocessing by setting
GOPROXYin the relevant BuildKit exec env. - Adds unit tests validating build-arg recognition and that the generated LLB exec env includes/omits
GOPROXYas expected.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| source.go | Adds SourceOpts.GomodProxy to carry the effective proxy override through source/generator operations. |
| preprocess.go | Threads GomodProxy into gomod patch preprocessing and sets GOPROXY for the patch exec when provided. |
| load.go | Marks DALEC_GOMOD_PROXY as a known/allowed build arg (so it doesn’t need to be declared in spec args). |
| generator_gomod.go | Adds the build-arg constant and applies GOPROXY to gomod dependency generation execs when provided. |
| generator_gomod_test.go | Adds tests confirming GOPROXY is included/omitted in gomod download + patch exec env and that the build arg is accepted. |
| frontend/gateway.go | Reads the build arg from the gateway client and populates SourceOpts.GomodProxy. |
| frontend/gateway_test.go | Adds coverage ensuring SourceOptFromUIClient correctly reads DALEC_GOMOD_PROXY. |
| determinism_test.go | Updates call site for the new gomod patch generation function signature. |
invidian
requested changes
Jul 15, 2026
Add DALEC_GOMOD_PROXY as a known frontend build arg and carry it through SourceOpts into gomod dependency generation and gomod patch preprocessing. Signed-off-by: Kartik Joshi <kartikjoshi@microsoft.com>
kartikjoshi21
force-pushed
the
kartikjoshi21/gomod-proxy-build-arg
branch
from
July 20, 2026 11:46
bb2ec89 to
233e031
Compare
invidian
approved these changes
Jul 20, 2026
invidian
left a comment
Contributor
There was a problem hiding this comment.
One small nit, otherwise LGTM
| client := newStubClient() | ||
| client.opts["build-arg:"+dalec.BuildArgDalecGomodProxy] = proxy | ||
|
|
||
| sOpt := SourceOptFromUIClient(context.Background(), client, nil, nil) |
Contributor
There was a problem hiding this comment.
nit: could use t.Context().
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.
Add DALEC_GOMOD_PROXY as a known frontend build arg and carry it through SourceOpts into gomod dependency generation and gomod patch preprocessing.
Fixes: #1072