mirror of https://github.com/golang/go.git
cmd/go: enable -x in go mod tidy
Updates #35849 Change-Id: I8b40a2de6a05880a9f939349a714b631888f5f94 Reviewed-on: https://go-review.googlesource.com/c/go/+/448915 Reviewed-by: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Run-TryBot: Bryan Mills <bcmills@google.com>
This commit is contained in:
parent
14018c8bec
commit
86bbcc6a75
|
|
@ -1285,7 +1285,7 @@
|
|||
//
|
||||
// Usage:
|
||||
//
|
||||
// go mod tidy [-e] [-v] [-go=version] [-compat=version]
|
||||
// go mod tidy [-e] [-v] [-x] [-go=version] [-compat=version]
|
||||
//
|
||||
// Tidy makes sure go.mod matches the source code in the module.
|
||||
// It adds any missing modules necessary to build the current module's
|
||||
|
|
@ -1313,6 +1313,8 @@
|
|||
// version prior to the one indicated by the 'go' directive in the go.mod
|
||||
// file.
|
||||
//
|
||||
// The -x flag causes tidy to print the commands download executes.
|
||||
//
|
||||
// See https://golang.org/ref/mod#go-mod-tidy for more about 'go mod tidy'.
|
||||
//
|
||||
// # Make vendored copy of dependencies
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import (
|
|||
)
|
||||
|
||||
var cmdTidy = &base.Command{
|
||||
UsageLine: "go mod tidy [-e] [-v] [-go=version] [-compat=version]",
|
||||
UsageLine: "go mod tidy [-e] [-v] [-x] [-go=version] [-compat=version]",
|
||||
Short: "add missing and remove unused modules",
|
||||
Long: `
|
||||
Tidy makes sure go.mod matches the source code in the module.
|
||||
|
|
@ -48,6 +48,8 @@ version. By default, tidy acts as if the -compat flag were set to the
|
|||
version prior to the one indicated by the 'go' directive in the go.mod
|
||||
file.
|
||||
|
||||
The -x flag causes tidy to print the commands download executes.
|
||||
|
||||
See https://golang.org/ref/mod#go-mod-tidy for more about 'go mod tidy'.
|
||||
`,
|
||||
Run: runTidy,
|
||||
|
|
@ -61,6 +63,7 @@ var (
|
|||
|
||||
func init() {
|
||||
cmdTidy.Flag.BoolVar(&cfg.BuildV, "v", false, "")
|
||||
cmdTidy.Flag.BoolVar(&cfg.BuildX, "x", false, "")
|
||||
cmdTidy.Flag.BoolVar(&tidyE, "e", false, "")
|
||||
cmdTidy.Flag.Var(&tidyGo, "go", "")
|
||||
cmdTidy.Flag.Var(&tidyCompat, "compat", "")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
# This test checks that "go mod tidy -x" print
|
||||
# commands tidy executes.
|
||||
# Verifies golang.org/issue/35849
|
||||
|
||||
rm $GOPATH/pkg/mod/cache/download/rsc.io/quote
|
||||
go mod tidy
|
||||
! stderr 'get '$GOPROXY
|
||||
|
||||
rm $GOPATH/pkg/mod/cache/download/rsc.io/quote
|
||||
go mod tidy -x
|
||||
stderr 'get '$GOPROXY
|
||||
|
||||
-- go.mod --
|
||||
module example.com/mod
|
||||
|
||||
-- a.go --
|
||||
package mod
|
||||
import _ "rsc.io/quote"
|
||||
Loading…
Reference in New Issue