diff options
author | Michael Matloob <matloob@golang.org> | 2023-05-17 14:04:25 -0400 |
---|---|---|
committer | Michael Matloob <matloob@golang.org> | 2023-07-24 18:09:22 +0000 |
commit | 89a457844f2b39794f9a8c16f008d3825f1ab455 (patch) | |
tree | 8cca92e05d1508daa4353aa279581cdaf0e984b7 /src/cmd/go/alldocs.go | |
parent | 7141d1e6d820241de321f8a9d336871737560950 (diff) | |
download | go-89a457844f2b39794f9a8c16f008d3825f1ab455.tar.gz go-89a457844f2b39794f9a8c16f008d3825f1ab455.zip |
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>
Diffstat (limited to 'src/cmd/go/alldocs.go')
-rw-r--r-- | src/cmd/go/alldocs.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go index bb28756133..45de1cc869 100644 --- a/src/cmd/go/alldocs.go +++ b/src/cmd/go/alldocs.go @@ -1504,6 +1504,7 @@ // init initialize workspace file // sync sync workspace build list to modules // use add modules to workspace file +// vendor make vendored copy of dependencies // // Use "go help work <command>" for more information about a command. // @@ -1652,6 +1653,27 @@ // See the workspaces reference at https://go.dev/ref/mod#workspaces // for more information. // +// # Make vendored copy of dependencies +// +// Usage: +// +// go work vendor [-e] [-v] [-o outdir] +// +// Vendor resets the workspace's vendor directory to include all packages +// needed to build and test all the workspace's packages. +// It does not include test code for vendored packages. +// +// The -v flag causes vendor to print the names of vendored +// modules and packages to standard error. +// +// The -e flag causes vendor to attempt to proceed despite errors +// encountered while loading packages. +// +// The -o flag causes vendor to create the vendor directory at the given +// path instead of "vendor". The go command can only use a vendor directory +// named "vendor" within the module root directory, so this flag is +// primarily useful for other tools. +// // # Compile and run Go program // // Usage: |