aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/modcmd/vendor.go
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2020-09-18 10:23:58 -0400
committerBryan C. Mills <bcmills@google.com>2020-09-22 17:04:13 +0000
commit3aa09489ab3aa13a3ac78b1ff012b148ffffe367 (patch)
tree9c79071f0aff54205f0afdc3e274f5af3257d368 /src/cmd/go/internal/modcmd/vendor.go
parent4e1d812afc2ebe767face21f34e47de57f3f32a6 (diff)
downloadgo-3aa09489ab3aa13a3ac78b1ff012b148ffffe367.tar.gz
go-3aa09489ab3aa13a3ac78b1ff012b148ffffe367.zip
cmd/go: add a '-e' flag to 'mod tidy' and 'mod vendor'
This flag, like the -e flag to 'go list', instructs the command to make a best effort to continue in spite of errors for specific packages. Fixes #26603 Change-Id: I5ee2f50c71870ae8ef3f9b3e5b045474adcca525 Reviewed-on: https://go-review.googlesource.com/c/go/+/255960 Trust: Bryan C. Mills <bcmills@google.com> Trust: Jay Conrod <jayconrod@google.com> Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
Diffstat (limited to 'src/cmd/go/internal/modcmd/vendor.go')
-rw-r--r--src/cmd/go/internal/modcmd/vendor.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/cmd/go/internal/modcmd/vendor.go b/src/cmd/go/internal/modcmd/vendor.go
index ddc27deb78..1bc4ab3def 100644
--- a/src/cmd/go/internal/modcmd/vendor.go
+++ b/src/cmd/go/internal/modcmd/vendor.go
@@ -25,7 +25,7 @@ import (
)
var cmdVendor = &base.Command{
- UsageLine: "go mod vendor [-v]",
+ UsageLine: "go mod vendor [-e] [-v]",
Short: "make vendored copy of dependencies",
Long: `
Vendor resets the main module's vendor directory to include all packages
@@ -34,12 +34,18 @@ 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.
`,
Run: runVendor,
}
+var vendorE bool // if true, report errors but proceed anyway
+
func init() {
cmdVendor.Flag.BoolVar(&cfg.BuildV, "v", false, "")
+ cmdVendor.Flag.BoolVar(&vendorE, "e", false, "")
base.AddModCommonFlags(&cmdVendor.Flag)
}
@@ -54,6 +60,7 @@ func runVendor(ctx context.Context, cmd *base.Command, args []string) {
Tags: imports.AnyTags(),
ResolveMissingImports: true,
UseVendorAll: true,
+ AllowErrors: vendorE,
}
_, pkgs := modload.LoadPackages(ctx, loadOpts, "all")