Skip to content

Use auto-vendor to eliminate vendor content from patch 0001#2367

Draft
gdams wants to merge 3 commits into
microsoft/mainfrom
dev/gadams/auto-vendor
Draft

Use auto-vendor to eliminate vendor content from patch 0001#2367
gdams wants to merge 3 commits into
microsoft/mainfrom
dev/gadams/auto-vendor

Conversation

@gdams

@gdams gdams commented Jun 12, 2026

Copy link
Copy Markdown
Member

Summary

Eliminates ~44k lines from the vendor patch by using the new auto vendor command in git go-patch. Vendor directories are now regenerated automatically via go mod vendor during apply, rather than being stored in the patch file.

Depends on

Changes

File Description
.git-go-patch Bump MinimumToolVersion to v1.1.0
patches/0001-Vendor-external-dependencies.patch Reduced from ~43,000 to ~240 lines. Vendor diffs stripped; auto vendor src src/cmd command added to commit message.
eng/_util/cmd/submodule-refresh/submodule-refresh.go Detect auto-vendor patches and use ApplyIndividually with RunGoModVendor callback (CI compatibility).
eng/_util/go.mod / go.sum Updated go-infra dependency to include auto-vendor support.

How it works

The patch commit message contains:

github.com/microsoft/go-infra/cmd/git-go-patch command: auto vendor src src/cmd
  • git go-patch extract strips vendor diffs from the patch file automatically.
  • git go-patch apply and submodule-refresh apply the patch, then run go mod vendor in src/ and src/cmd/, and amend the commit.

Before / After

Before: 0001-Vendor-external-dependencies.patch = 42,929 lines of vendored Go source
After: 0001-Vendor-external-dependencies.patch = 238 lines (go.mod, go.sum, and a few small files)

TODO before merging

  • Merge go-infra PR #506
  • Update eng/_util/go.mod to point at the merged go-infra commit on main

@gdams gdams force-pushed the dev/gadams/auto-vendor branch 10 times, most recently from eed097d to 1c51290 Compare June 12, 2026 14:01
Replace the ~45,000-line vendor patch with a ~240-line patch that only
tracks go.mod, go.sum, and related non-vendor files. Vendor directories
are now regenerated automatically during 'git go-patch apply' and
'submodule-refresh' using 'go mod vendor'.

Changes:
- .git-go-patch: bump MinimumToolVersion to v1.1.0
- patches/0001: strip vendor diffs, add 'auto vendor src src/cmd' command
- submodule-refresh.go: use ScanAutoVendorPatches + ApplyIndividually
- eng/_util/go.mod: update go-infra dependency

Depends on: microsoft/go-infra#506
@gdams gdams force-pushed the dev/gadams/auto-vendor branch from 1c51290 to eadd75a Compare June 12, 2026 14:12
gdams added 2 commits June 12, 2026 15:27
…n submodule-refresh

- Include all 27 cryptobackend subpackage imports in deps_ignore.go so
  go mod vendor pulls in every needed package during auto-vendor.
- Add a final vendor pass in submodule-refresh after all patches are
  applied, to pick up imports added by later patches (e.g. patch 0002).
- Update go-infra dependency to 70acb19 (vendor.go fixes).
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