go/build/v2: honor vendor input - #2630
Open
rakshitgondwal wants to merge 1 commit into
Open
Conversation
Preserve existing module and workspace vendor trees, generate them only when missing, and force go build to consume them when vendor is enabled. Add end-to-end coverage for patched, generated, disabled, and workspace vendoring. Signed-off-by: Rakshit Gondwal <rakshit.gondwal@chainguard.dev>
xnox
reviewed
Sep 3, 2026
xnox
left a comment
Member
There was a problem hiding this comment.
I hoped to not support vendor trees at all. But I see why this might be needed.
A quick check, do we have an overlap in functionality between this and omnibump?
For example - if omnibump bumps dependencies, does it already regenerates vendor tree? and separately, if patches are applied - surely we shouldn't touch vendor tree at all then?
I just hope not to support vendor trees here at all if possible. And only add this, if we truly have a usecase. Will ping you on slack to discuss what can be done here. If there is more than one package/version-stream that needs it, then happy to add this in.
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.
Summary
go/build/v2honor its existingvendorinputgo buildto consume it with-mod=vendorWhy
go/build/v2has declaredvendorsince it was introduced in #2538, but the input is never consumed. This surfaced while reviewing chainguard-dev/stereo#268366.Unconditionally regenerating
vendor/is unsafe because callers can patch vendored source before building. Only forcing-mod=vendoris also insufficient for existing callers that setvendor: truewithout a pre-existing tree. This change handles both cases and leaves the defaultvendor: falsebehavior unchanged.Validation
go test ./pkg/build/...x86_64git diff --checkvendor: falsedoes not force vendor modego work vendorThe new
go-build-v2-vendor-build-test.yamljob provides the same coverage in Melange's e2e suite.Melange Pull Request Template
Functional Changes
Notes: Full Wolfi was not rebuilt locally. The change is opt-in and the focused module/workspace regression coverage is included in this PR.
SCA Changes
Notes: Not applicable; this does not change SCA behavior.
Linter
Notes: Not applicable; this does not add or change a linter.