]> Cypherpunks repositories - gostls13.git/commit
cmd/go: add support for vendoring in workspace mode
authorMichael Matloob <matloob@golang.org>
Wed, 17 May 2023 18:04:25 +0000 (14:04 -0400)
committerMichael Matloob <matloob@golang.org>
Mon, 24 Jul 2023 18:09:22 +0000 (18:09 +0000)
commit89a457844f2b39794f9a8c16f008d3825f1ab455
tree8cca92e05d1508daa4353aa279581cdaf0e984b7
parent7141d1e6d820241de321f8a9d336871737560950
cmd/go: add support for vendoring in workspace mode

In most cases this change removes assumptions that there is a single
main module in vendor mode and iterates over the workspace modules
when doing checks. The go mod vendor command will now, if in workspace
mode, create a vendor directory in the same directory as the go.work
file, containing the packages (and modules in modules.txt) loaded from
the workspace. When reassembling the module graph from the vendor
directory, an edges are added from each of the main modules to their
requirements, plus additionally to a fake 'vendor/modules.txt' module
with edges to all the modules listed in vendor/modules.txt.

For #60056

Change-Id: I4a485bb39836e7ab35cdc7726229191c6599903e
Reviewed-on: https://go-review.googlesource.com/c/go/+/495801
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
17 files changed:
src/cmd/go/alldocs.go
src/cmd/go/internal/modcmd/vendor.go
src/cmd/go/internal/modload/buildlist.go
src/cmd/go/internal/modload/import.go
src/cmd/go/internal/modload/init.go
src/cmd/go/internal/modload/load.go
src/cmd/go/internal/modload/modfile.go
src/cmd/go/internal/modload/search.go
src/cmd/go/internal/modload/vendor.go
src/cmd/go/internal/workcmd/vendor.go [new file with mode: 0644]
src/cmd/go/internal/workcmd/work.go
src/cmd/go/testdata/script/work.txt
src/cmd/go/testdata/script/work_vendor_empty.txt [new file with mode: 0644]
src/cmd/go/testdata/script/work_vendor_main_module_replaced.txt [new file with mode: 0644]
src/cmd/go/testdata/script/work_vendor_modules_txt_consistent.txt [new file with mode: 0644]
src/cmd/go/testdata/script/work_vendor_prune.txt [new file with mode: 0644]
src/cmd/go/testdata/script/work_vendor_prune_all.txt [new file with mode: 0644]