[go] cmd/go: add 'go mod vendor -o' flag

44 views
Skip to first unread message

Paschalis Tsilias (Gerrit)

unread,
Jul 28, 2021, 10:21:42 AM7/28/21
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Paschalis Tsilias has uploaded this change for review.

View Change

cmd/go: add 'go mod vendor -o' flag

Adds a new flag to 'go mod vendor' which overrides the default
'vendor' destination directory. This can be helpful for writing the
vendor tree to a temporary location so it can be uploaded to a remote
build system. The argument can be a relative or an absolute path. This
flag has no other influence on how the command behaves.

Fixes #47327

Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
---
M src/cmd/go/alldocs.go
M src/cmd/go/internal/modcmd/vendor.go
M src/cmd/go/testdata/script/mod_vendor.txt
3 files changed, 51 insertions(+), 4 deletions(-)

diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go
index 954caae..460227a 100644
--- a/src/cmd/go/alldocs.go
+++ b/src/cmd/go/alldocs.go
@@ -1260,7 +1260,7 @@
//
// Usage:
//
-// go mod vendor [-e] [-v]
+// go mod vendor [-e] [-v] [-o outdir]
//
// Vendor resets the main module's vendor directory to include all packages
// needed to build and test all the main module's packages.
@@ -1272,6 +1272,9 @@
// The -e flag causes vendor to attempt to proceed despite errors
// encountered while loading packages.
//
+// The -o flag receives a relative or absolute path and causes vendor to
+// override the destination directory. Defaults to 'vendor'.
+//
// See https://golang.org/ref/mod#go-mod-vendor for more about 'go mod vendor'.
//
//
diff --git a/src/cmd/go/internal/modcmd/vendor.go b/src/cmd/go/internal/modcmd/vendor.go
index 713d5f9..0b7528b 100644
--- a/src/cmd/go/internal/modcmd/vendor.go
+++ b/src/cmd/go/internal/modcmd/vendor.go
@@ -31,7 +31,7 @@
)

var cmdVendor = &base.Command{
- UsageLine: "go mod vendor [-e] [-v]",
+ UsageLine: "go mod vendor [-e] [-v] [-o outdir]",
Short: "make vendored copy of dependencies",
Long: `
Vendor resets the main module's vendor directory to include all packages
@@ -44,16 +44,21 @@
The -e flag causes vendor to attempt to proceed despite errors
encountered while loading packages.

+The -o flag receives a relative or absolute path and causes vendor to
+override the destination directory. Defaults to 'vendor'.
+
See https://golang.org/ref/mod#go-mod-vendor for more about 'go mod vendor'.
`,
Run: runVendor,
}

-var vendorE bool // if true, report errors but proceed anyway
+var vendorE bool // if true, report errors but proceed anyway
+var vendorO string // if set, overrides the default output directory

func init() {
cmdVendor.Flag.BoolVar(&cfg.BuildV, "v", false, "")
cmdVendor.Flag.BoolVar(&vendorE, "e", false, "")
+ cmdVendor.Flag.StringVar(&vendorO, "o", "vendor", "")
base.AddModCommonFlags(&cmdVendor.Flag)
}

@@ -74,7 +79,13 @@
}
_, pkgs := modload.LoadPackages(ctx, loadOpts, "all")

- vdir := filepath.Join(modload.ModRoot(), "vendor")
+ var vdir string
+ if filepath.IsAbs(vendorO) {
+ vdir = vendorO
+ } else {
+ vdir = filepath.Join(modload.ModRoot(), vendorO)
+ }
+
if err := os.RemoveAll(vdir); err != nil {
base.Fatalf("go mod vendor: %v", err)
}
diff --git a/src/cmd/go/testdata/script/mod_vendor.txt b/src/cmd/go/testdata/script/mod_vendor.txt
index 2622916..0ea3152f 100644
--- a/src/cmd/go/testdata/script/mod_vendor.txt
+++ b/src/cmd/go/testdata/script/mod_vendor.txt
@@ -82,6 +82,39 @@
! exists vendor/x/x2
! exists vendor/x/x2/LICENSE

+# 'go mod vendor' should work with an alternative vendor directory if the -o flag is provided.
+go mod vendor -v -o alternative-vendor-dir
+stderr '^# x v1.0.0 => ./x'
+stderr '^x'
+stderr '^# y v1.0.0 => ./y'
+stderr '^y'
+stderr '^# z v1.0.0 => ./z'
+stderr '^z'
+! stderr '^w'
+grep 'a/foo/bar/b\na/foo/bar/c' alternative-vendor-dir/modules.txt # must be sorted
+
+# Test dependencies should not be copied.
+! exists alternative-vendor-dir/x/testdata
+! exists alternative-vendor-dir/a/foo/bar/b/ignored.go
+! exists alternative-vendor-dir/a/foo/bar/b/main_test.go
+
+# Licenses and other metadata for each module should be copied
+# if any package within their module is copied.
+exists alternative-vendor-dir/a/foo/AUTHORS.txt
+exists alternative-vendor-dir/a/foo/CONTRIBUTORS
+exists alternative-vendor-dir/a/foo/LICENSE
+exists alternative-vendor-dir/a/foo/PATENTS
+exists alternative-vendor-dir/a/foo/COPYING
+exists alternative-vendor-dir/a/foo/COPYLEFT
+exists alternative-vendor-dir/x/NOTICE!
+exists alternative-vendor-dir/mysite/myname/mypkg/LICENSE.txt
+
+! exists alternative-vendor-dir/a/foo/licensed-to-kill
+! exists alternative-vendor-dir/w
+! exists alternative-vendor-dir/w/LICENSE
+! exists alternative-vendor-dir/x/x2
+! exists alternative-vendor-dir/x/x2/LICENSE
+
[short] stop

# 'go build' and 'go test' using vendored packages should succeed.

To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
Gerrit-Change-Number: 338149
Gerrit-PatchSet: 1
Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
Gerrit-MessageType: newchange

Paschalis Tsilias (Gerrit)

unread,
Jul 28, 2021, 10:36:47 AM7/28/21
to goph...@pubsubhelper.golang.org, Bryan C. Mills, Jay Conrod, Michael Matloob, Russ Cox, Ian Lance Taylor, Go Bot, golang-co...@googlegroups.com

Attention is currently required from: Bryan C. Mills, Jay Conrod, Michael Matloob.

View Change

1 comment:

  • Patchset:

    • Patch Set #1:

      I'm not sure whether this required a new test script, or if we're okay with just expanding the current one. Let me know what you think and if I've missed anything obvious.

      Thank you for your time!

To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
Gerrit-Change-Number: 338149
Gerrit-PatchSet: 1
Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
Gerrit-CC: Go Bot <go...@golang.org>
Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
Gerrit-CC: Russ Cox <r...@golang.org>
Gerrit-Attention: Bryan C. Mills <bcm...@google.com>
Gerrit-Attention: Jay Conrod <jayc...@google.com>
Gerrit-Attention: Michael Matloob <mat...@golang.org>
Gerrit-Comment-Date: Wed, 28 Jul 2021 14:36:41 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

Jay Conrod (Gerrit)

unread,
Jul 28, 2021, 12:39:40 PM7/28/21
to Paschalis Tsilias, goph...@pubsubhelper.golang.org, Bryan C. Mills, Michael Matloob, Russ Cox, Ian Lance Taylor, Go Bot, golang-co...@googlegroups.com

Attention is currently required from: Bryan C. Mills, Paschalis Tsilias, Michael Matloob.

Patch set 1:Run-TryBot +1

View Change

5 comments:

  • Patchset:

    • Patch Set #1:

      I'm not sure whether this required a new test script, or if we're okay with just expanding the curre […]

      This is good. Would be fine either way.

    • Patch Set #1:

      Thanks for working on this!

  • File src/cmd/go/internal/modcmd/vendor.go:

    • Patch Set #1, Line 47: receives a relative or absolute path and

      Let's rephrase and add a bit more detail about when this should be used.

        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.
    • Patch Set #1, Line 61: cmdVendor.Flag.StringVar(&vendorO, "o", "vendor", "")

      Let's export base.explicitStringFlag and use that here.

      If -o is set to a relative path, I think that path should be interpreted relative to the current working directory (base.Cwd()) instead of the module root directory. But when -o is not set, "vendor" should definitely be in the module root directory.

  • File src/cmd/go/testdata/script/mod_vendor.txt:

    • Patch Set #1, Line 86: go mod vendor -v -o alternative-vendor-dir

      To test the case I mentioned, let's mkdir and cd into a subdirectory, then run go mod vendor there.

To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
Gerrit-Change-Number: 338149
Gerrit-PatchSet: 1
Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
Gerrit-CC: Go Bot <go...@golang.org>
Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
Gerrit-CC: Russ Cox <r...@golang.org>
Gerrit-Attention: Bryan C. Mills <bcm...@google.com>
Gerrit-Attention: Paschalis Tsilias <paschali...@gmail.com>
Gerrit-Attention: Michael Matloob <mat...@golang.org>
Gerrit-Comment-Date: Wed, 28 Jul 2021 16:39:35 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Paschalis Tsilias <paschali...@gmail.com>
Gerrit-MessageType: comment

Paschalis Tsilias (Gerrit)

unread,
Jul 30, 2021, 1:00:32 PM7/30/21
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Attention is currently required from: Bryan C. Mills, Paschalis Tsilias, Michael Matloob.

Paschalis Tsilias uploaded patch set #2 to this change.

View Change

cmd/go: add 'go mod vendor -o' flag

Adds a new flag to 'go mod vendor' which overrides the default
'vendor' destination directory. This can be helpful for writing the
vendor tree to a temporary location for use by other tools.

The argument can be a relative or an absolute path.
This flag has no other influence on how the command behaves.

Fixes #47327

Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
---
M src/cmd/go/alldocs.go
M src/cmd/go/internal/base/flag.go
M src/cmd/go/internal/modcmd/vendor.go
M src/cmd/go/testdata/script/mod_vendor.txt
4 files changed, 88 insertions(+), 15 deletions(-)

To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
Gerrit-Change-Number: 338149
Gerrit-PatchSet: 2
Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
Gerrit-Reviewer: Go Bot <go...@golang.org>
Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
Gerrit-CC: Russ Cox <r...@golang.org>
Gerrit-Attention: Bryan C. Mills <bcm...@google.com>
Gerrit-Attention: Paschalis Tsilias <paschali...@gmail.com>
Gerrit-Attention: Michael Matloob <mat...@golang.org>
Gerrit-MessageType: newpatchset

Paschalis Tsilias (Gerrit)

unread,
Jul 30, 2021, 1:05:16 PM7/30/21
to goph...@pubsubhelper.golang.org, Go Bot, Jay Conrod, Bryan C. Mills, Michael Matloob, Russ Cox, Ian Lance Taylor, golang-co...@googlegroups.com

Attention is currently required from: Bryan C. Mills, Jay Conrod, Michael Matloob.

View Change

3 comments:

  • File src/cmd/go/internal/modcmd/vendor.go:

    • Let's rephrase and add a bit more detail about when this should be used. […]

      Done

    • Let's export base.explicitStringFlag and use that here. […]

      Thank you for your feedback!

      • I exported `base.ExplicitStringFlag` and its fields, let me know how it looks. Otherwise, we could create a new local flag type for this feature.
      • You're right about the current working directory. My initial thought was to have the folder in the module root to reduce potential errors like the temp vendor folder ending up inside some other module, but I think your suggestion is way more in line with what a user should expect.
  • File src/cmd/go/testdata/script/mod_vendor.txt:

    • Patch Set #1, Line 86: go mod vendor -v -o alternative-vendor-dir

      To test the case I mentioned, let's mkdir and cd into a subdirectory, then run go mod vendor there.

    • Done

To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
Gerrit-Change-Number: 338149
Gerrit-PatchSet: 2
Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
Gerrit-Reviewer: Go Bot <go...@golang.org>
Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
Gerrit-CC: Russ Cox <r...@golang.org>
Gerrit-Attention: Bryan C. Mills <bcm...@google.com>
Gerrit-Attention: Jay Conrod <jayc...@google.com>
Gerrit-Attention: Michael Matloob <mat...@golang.org>
Gerrit-Comment-Date: Fri, 30 Jul 2021 17:05:04 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Jay Conrod <jayc...@google.com>
Gerrit-MessageType: comment

Bryan C. Mills (Gerrit)

unread,
Jul 30, 2021, 3:58:50 PM7/30/21
to Paschalis Tsilias, goph...@pubsubhelper.golang.org, Go Bot, Jay Conrod, Bryan C. Mills, Michael Matloob, Russ Cox, Ian Lance Taylor, golang-co...@googlegroups.com

Attention is currently required from: Paschalis Tsilias, Jay Conrod, Michael Matloob.

View Change

3 comments:

  • File src/cmd/go/internal/modcmd/vendor.go:

    • Patch Set #2, Line 89:

      	case vendorDirExplicit && !filepath.IsAbs(vendorDirValue):
      vdir = filepath.Join(base.Cwd(), vendorDirValue)

      What does this do for `go mod vendor -o ''`?

      I could see someone running that if they had `GOFLAGS=-o=foo` set for some reason; probably it should reset the behavior to the default rather than treating it the same as `-o .`.

  • File src/cmd/go/testdata/script/mod_vendor.txt:

    • # Test dependencies should not be copied.

    • ! exists alternative-vendor-dir/x/testdata
      ! exists alternative-vendor-dir/a/foo/bar/b/ignored.go
      ! exists alternative-vendor-dir/a/foo/bar/b/main_test.go



    • # Licenses and other metadata for each module should be copied

    • # if any package within their module is copied.

    • exists alternative-vendor-dir/a/foo/AUTHORS.txt
      exists alternative-vendor-dir/a/foo/CONTRIBUTORS
      exists alternative-vendor-dir/a/foo/LICENSE
      exists alternative-vendor-dir/a/foo/PATENTS
      exists alternative-vendor-dir/a/foo/COPYING
      exists alternative-vendor-dir/a/foo/COPYLEFT
      exists alternative-vendor-dir/x/NOTICE!
      exists alternative-vendor-dir/mysite/myname/mypkg/LICENSE.txt

      ! exists alternative-vendor-dir/a/foo/licensed-to-kill
      ! exists alternative-vendor-dir/w
      ! exists alternative-vendor-dir/w/LICENSE
      ! exists alternative-vendor-dir/x/x2
      ! exists alternative-vendor-dir/x/x2/LICENSE

      (nit) I'm not sure that it's worth repeating all of these details for the test of the `-o` flag.

      It should suffice to show the existence of modules.txt and perhaps a few key other files.

    • Patch Set #2, Line 123: go mod vendor -v -o relative-vendor-dir

      Please also add a test for `-o ''`.

To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
Gerrit-Change-Number: 338149
Gerrit-PatchSet: 2
Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
Gerrit-Reviewer: Go Bot <go...@golang.org>
Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
Gerrit-CC: Russ Cox <r...@golang.org>
Gerrit-Attention: Paschalis Tsilias <paschali...@gmail.com>
Gerrit-Attention: Jay Conrod <jayc...@google.com>
Gerrit-Attention: Michael Matloob <mat...@golang.org>
Gerrit-Comment-Date: Fri, 30 Jul 2021 19:58:46 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

Paschalis Tsilias (Gerrit)

unread,
Aug 3, 2021, 2:07:39 AM8/3/21
to goph...@pubsubhelper.golang.org, Go Bot, Jay Conrod, Bryan C. Mills, Michael Matloob, Russ Cox, Ian Lance Taylor, golang-co...@googlegroups.com

Attention is currently required from: Bryan C. Mills, Jay Conrod, Michael Matloob.

View Change

1 comment:

  • File src/cmd/go/internal/modcmd/vendor.go:

    • Patch Set #2, Line 89:

      	case vendorDirExplicit && !filepath.IsAbs(vendorDirValue):
      vdir = filepath.Join(base.Cwd(), vendorDirValue)

    • What does this do for `go mod vendor -o ''`? […]

      Thanks for the observation!

      If we run this with just `-o ""` it defaults to the previous behavior as `ExplicitStringFlag` doesn't count it as being explicitly set, which is fine.

      Unfortunately, if -o is set in GOFLAGS beforehand, running `-o ""` destroys the current working directory, so it probably needs some kind of special handling.

      I'll try adding a new condition and I'll ping you again.

To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
Gerrit-Change-Number: 338149
Gerrit-PatchSet: 2
Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
Gerrit-Reviewer: Go Bot <go...@golang.org>
Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
Gerrit-CC: Russ Cox <r...@golang.org>
Gerrit-Attention: Bryan C. Mills <bcm...@google.com>
Gerrit-Attention: Jay Conrod <jayc...@google.com>
Gerrit-Attention: Michael Matloob <mat...@golang.org>
Gerrit-Comment-Date: Tue, 03 Aug 2021 06:07:34 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Bryan C. Mills <bcm...@google.com>
Gerrit-MessageType: comment

Paschalis Tsilias (Gerrit)

unread,
Aug 7, 2021, 9:16:07 AM8/7/21
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Attention is currently required from: Bryan C. Mills, Jay Conrod, Michael Matloob.

Paschalis Tsilias uploaded patch set #3 to this change.

View Change

cmd/go: add 'go mod vendor -o' flag

Adds a new flag to 'go mod vendor' which overrides the default
'vendor' destination directory. This can be helpful for writing the
vendor tree to a temporary location for use by other tools.
The argument can be a relative or an absolute path.
This flag has no other influence on how the command behaves.

Fixes #47327

Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
---
M src/cmd/go/alldocs.go
M src/cmd/go/internal/base/flag.go
M src/cmd/go/internal/modcmd/vendor.go
M src/cmd/go/testdata/script/mod_vendor.txt
4 files changed, 75 insertions(+), 15 deletions(-)

To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
Gerrit-Change-Number: 338149
Gerrit-PatchSet: 3
Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
Gerrit-Reviewer: Go Bot <go...@golang.org>
Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
Gerrit-CC: Russ Cox <r...@golang.org>
Gerrit-Attention: Bryan C. Mills <bcm...@google.com>
Gerrit-Attention: Jay Conrod <jayc...@google.com>
Gerrit-Attention: Michael Matloob <mat...@golang.org>
Gerrit-MessageType: newpatchset

Paschalis Tsilias (Gerrit)

unread,
Aug 7, 2021, 9:26:54 AM8/7/21
to goph...@pubsubhelper.golang.org, Go Bot, Jay Conrod, Bryan C. Mills, Michael Matloob, Russ Cox, Ian Lance Taylor, golang-co...@googlegroups.com

Attention is currently required from: Bryan C. Mills, Jay Conrod, Michael Matloob.

View Change

3 comments:

  • File src/cmd/go/internal/modcmd/vendor.go:

    • Patch Set #2, Line 89:

      	case vendorDirExplicit && !filepath.IsAbs(vendorDirValue):
      vdir = filepath.Join(base.Cwd(), vendorDirValue)

    • Thanks for the observation! […]

      I used filepath.Clean to ensure that we don't end up deleting the current working directory, and fall back to the default behavior.

      Let me know what you think, maybe there's a better way to achieve the same result. I could also extract this logic in a helper to keep the flow cleaner.

  • File src/cmd/go/testdata/script/mod_vendor.txt:

    • Patch Set #2, Line 96:

      # Test dependencies should not be copied.
      ! exists alternative-vendor-dir/x/testdata
      ! exists alternative-vendor-dir/a/foo/bar/b/ignored.go
      ! exists alternative-vendor-dir/a/foo/bar/b/main_test.go

      # Licenses and other metadata for each module should be copied
      # if any package within their module is copied.
      exists alternative-vendor-dir/a/foo/AUTHORS.txt
      exists alternative-vendor-dir/a/foo/CONTRIBUTORS
      exists alternative-vendor-dir/a/foo/LICENSE
      exists alternative-vendor-dir/a/foo/PATENTS
      exists alternative-vendor-dir/a/foo/COPYING
      exists alternative-vendor-dir/a/foo/COPYLEFT
      exists alternative-vendor-dir/x/NOTICE!
      exists alternative-vendor-dir/mysite/myname/mypkg/LICENSE.txt

      ! exists alternative-vendor-dir/a/foo/licensed-to-kill
      ! exists alternative-vendor-dir/w
      ! exists alternative-vendor-dir/w/LICENSE
      ! exists alternative-vendor-dir/x/x2
      ! exists alternative-vendor-dir/x/x2/LICENSE

    • (nit) I'm not sure that it's worth repeating all of these details for the test of the `-o` flag. […]

      You're right. I removed most extraneous checks, I think it looks easier to read now!

    • Done. I've added a test for `-o ""` with and without GOFLAGS, as well as a test for an absolute path.

To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
Gerrit-Change-Number: 338149
Gerrit-PatchSet: 3
Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
Gerrit-Reviewer: Go Bot <go...@golang.org>
Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
Gerrit-CC: Russ Cox <r...@golang.org>
Gerrit-Attention: Bryan C. Mills <bcm...@google.com>
Gerrit-Attention: Jay Conrod <jayc...@google.com>
Gerrit-Attention: Michael Matloob <mat...@golang.org>
Gerrit-Comment-Date: Sat, 07 Aug 2021 13:26:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Bryan C. Mills <bcm...@google.com>

Jay Conrod (Gerrit)

unread,
Aug 9, 2021, 5:18:05 PM8/9/21
to Paschalis Tsilias, goph...@pubsubhelper.golang.org, Go Bot, Bryan C. Mills, Michael Matloob, Russ Cox, Ian Lance Taylor, golang-co...@googlegroups.com

Attention is currently required from: Bryan C. Mills, Paschalis Tsilias, Michael Matloob.

Patch set 3:Run-TryBot +1

View Change

1 comment:

  • File src/cmd/go/internal/modcmd/vendor.go:

    • Patch Set #2, Line 89:

      	case vendorDirExplicit && !filepath.IsAbs(vendorDirValue):
      vdir = filepath.Join(base.Cwd(), vendorDirValue)

    • I used filepath. […]

      Let's simplify this a bit and just check for vendorDirExplicit && vendorDirValue == "". That makes the code a bit clearer.

      Weird as it is, 'go mod vendor -o=.' should attempt to delete the current directory and create the vendor directory there. I don't expect that to succeed on all operating systems, but it will probably work on linux and darwin. For example, this works today:

        mkdir vendor
      cd vendor
      go mod vendor
      ls # nothing here?
      cd .
      ls. # files here now.

To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
Gerrit-Change-Number: 338149
Gerrit-PatchSet: 3
Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
Gerrit-Reviewer: Go Bot <go...@golang.org>
Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
Gerrit-CC: Russ Cox <r...@golang.org>
Gerrit-Attention: Bryan C. Mills <bcm...@google.com>
Gerrit-Attention: Paschalis Tsilias <paschali...@gmail.com>
Gerrit-Attention: Michael Matloob <mat...@golang.org>
Gerrit-Comment-Date: Mon, 09 Aug 2021 21:17:59 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes

Paschalis Tsilias (Gerrit)

unread,
Aug 10, 2021, 8:52:11 AM8/10/21
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Attention is currently required from: Bryan C. Mills, Paschalis Tsilias, Michael Matloob.

Paschalis Tsilias uploaded patch set #4 to this change.

View Change

cmd/go: add 'go mod vendor -o' flag

Adds a new flag to 'go mod vendor' which overrides the default
'vendor' destination directory. This can be helpful for writing the
vendor tree to a temporary location for use by other tools.
The argument can be a relative or an absolute path.
This flag has no other influence on how the command behaves.

Fixes #47327

Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
---
M src/cmd/go/alldocs.go
M src/cmd/go/internal/base/flag.go
M src/cmd/go/internal/modcmd/vendor.go
M src/cmd/go/testdata/script/mod_vendor.txt
4 files changed, 71 insertions(+), 15 deletions(-)

To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
Gerrit-Change-Number: 338149
Gerrit-PatchSet: 4
Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
Gerrit-Reviewer: Go Bot <go...@golang.org>
Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
Gerrit-CC: Russ Cox <r...@golang.org>
Gerrit-Attention: Bryan C. Mills <bcm...@google.com>
Gerrit-Attention: Paschalis Tsilias <paschali...@gmail.com>
Gerrit-Attention: Michael Matloob <mat...@golang.org>
Gerrit-MessageType: newpatchset

Paschalis Tsilias (Gerrit)

unread,
Aug 10, 2021, 8:59:42 AM8/10/21
to goph...@pubsubhelper.golang.org, Go Bot, Jay Conrod, Bryan C. Mills, Michael Matloob, Russ Cox, Ian Lance Taylor, golang-co...@googlegroups.com

Attention is currently required from: Bryan C. Mills, Jay Conrod, Michael Matloob.

View Change

1 comment:

  • File src/cmd/go/internal/modcmd/vendor.go:

    • Patch Set #2, Line 89:

      	case vendorDirExplicit && !filepath.IsAbs(vendorDirValue):
      vdir = filepath.Join(base.Cwd(), vendorDirValue)

    • Let's simplify this a bit and just check for vendorDirExplicit && vendorDirValue == "". […]

      You meant `vendorDirValue != ""` so that it falls back to the default behavior for an empty argument, right?

      Thanks for the suggestion, indeed it looks cleaner now. I initially wanted to avoid deleting ModRoot by accident (would be a bummer), but it makes more sense to allow the current dir to be used.

To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
Gerrit-Change-Number: 338149
Gerrit-PatchSet: 4
Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
Gerrit-Reviewer: Go Bot <go...@golang.org>
Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
Gerrit-CC: Russ Cox <r...@golang.org>
Gerrit-Attention: Bryan C. Mills <bcm...@google.com>
Gerrit-Attention: Jay Conrod <jayc...@google.com>
Gerrit-Attention: Michael Matloob <mat...@golang.org>
Gerrit-Comment-Date: Tue, 10 Aug 2021 12:59:36 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Bryan C. Mills <bcm...@google.com>
Comment-In-Reply-To: Paschalis Tsilias <paschali...@gmail.com>

Jay Conrod (Gerrit)

unread,
Aug 10, 2021, 11:01:55 AM8/10/21
to Paschalis Tsilias, goph...@pubsubhelper.golang.org, Go Bot, Bryan C. Mills, Michael Matloob, Russ Cox, Ian Lance Taylor, golang-co...@googlegroups.com

Attention is currently required from: Bryan C. Mills, Michael Matloob.

Patch set 4:Run-TryBot +1

View Change

    To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
    Gerrit-Change-Number: 338149
    Gerrit-PatchSet: 4
    Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
    Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
    Gerrit-Reviewer: Go Bot <go...@golang.org>
    Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
    Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
    Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
    Gerrit-CC: Russ Cox <r...@golang.org>
    Gerrit-Attention: Bryan C. Mills <bcm...@google.com>
    Gerrit-Attention: Michael Matloob <mat...@golang.org>
    Gerrit-Comment-Date: Tue, 10 Aug 2021 15:01:50 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    Gerrit-MessageType: comment

    Jay Conrod (Gerrit)

    unread,
    Aug 10, 2021, 12:04:17 PM8/10/21
    to Paschalis Tsilias, goph...@pubsubhelper.golang.org, Go Bot, Bryan C. Mills, Michael Matloob, Russ Cox, Ian Lance Taylor, golang-co...@googlegroups.com

    Attention is currently required from: Bryan C. Mills, Paschalis Tsilias, Michael Matloob.

    Jay Conrod removed a vote from this change.

    View Change

    Removed Run-TryBot+1 by Jay Conrod <jayc...@google.com>

    To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
    Gerrit-Change-Number: 338149
    Gerrit-PatchSet: 4
    Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
    Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
    Gerrit-Reviewer: Go Bot <go...@golang.org>
    Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
    Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
    Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
    Gerrit-CC: Russ Cox <r...@golang.org>
    Gerrit-Attention: Bryan C. Mills <bcm...@google.com>
    Gerrit-Attention: Paschalis Tsilias <paschali...@gmail.com>
    Gerrit-Attention: Michael Matloob <mat...@golang.org>
    Gerrit-MessageType: deleteVote

    Jay Conrod (Gerrit)

    unread,
    Aug 10, 2021, 12:04:39 PM8/10/21
    to Paschalis Tsilias, goph...@pubsubhelper.golang.org, Go Bot, Bryan C. Mills, Michael Matloob, Russ Cox, Ian Lance Taylor, golang-co...@googlegroups.com

    Attention is currently required from: Bryan C. Mills, Paschalis Tsilias, Michael Matloob.

    Patch set 4:Run-TryBot +1Code-Review +2Trust +1

    View Change

    1 comment:

    • Patchset:

      • Patch Set #4:

        Looks good. Test timeout seems unrelated, but running TryBots again to be sure.

    To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
    Gerrit-Change-Number: 338149
    Gerrit-PatchSet: 4
    Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
    Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
    Gerrit-Reviewer: Go Bot <go...@golang.org>
    Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
    Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
    Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
    Gerrit-CC: Russ Cox <r...@golang.org>
    Gerrit-Attention: Bryan C. Mills <bcm...@google.com>
    Gerrit-Attention: Paschalis Tsilias <paschali...@gmail.com>
    Gerrit-Attention: Michael Matloob <mat...@golang.org>
    Gerrit-Comment-Date: Tue, 10 Aug 2021 16:04:35 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Gerrit-MessageType: comment

    Bryan C. Mills (Gerrit)

    unread,
    Aug 10, 2021, 3:04:48 PM8/10/21
    to Paschalis Tsilias, goph...@pubsubhelper.golang.org, Bryan C. Mills, Jay Conrod, Go Bot, Michael Matloob, Russ Cox, Ian Lance Taylor, golang-co...@googlegroups.com

    Attention is currently required from: Paschalis Tsilias, Michael Matloob.

    Patch set 4:Trust +1

    View Change

    2 comments:

    • File src/cmd/go/internal/modcmd/vendor.go:

      • Patch Set #4, Line 58: var vendorDirValue = "vendor"

        I don't think this default matches the implementation in runVendor: outside of the root of the main module, `-o vendor` is relative to the current working directory, but `-o ""' is `$GOMOD/../vendor`.

        I think we should default this to `""`, and then we can probably drop the vendorDirExplicit variable, because vendorDirValue != "" would then imply vendorDirExplicit in all cases.

    • File src/cmd/go/testdata/script/mod_vendor.txt:


      • go mod vendor -v -o relative-vendor-dir

      • go mod vendor -v -o ../dir2/relative-vendor-dir

        Also test the behavior of `-o ''` when in a subdirectory? (Right now we only seem to be testing it in the module root.)

    To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
    Gerrit-Change-Number: 338149
    Gerrit-PatchSet: 4
    Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
    Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
    Gerrit-Reviewer: Go Bot <go...@golang.org>
    Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
    Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
    Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
    Gerrit-CC: Russ Cox <r...@golang.org>
    Gerrit-Attention: Paschalis Tsilias <paschali...@gmail.com>
    Gerrit-Attention: Michael Matloob <mat...@golang.org>
    Gerrit-Comment-Date: Tue, 10 Aug 2021 19:04:40 +0000

    Paschalis Tsilias (Gerrit)

    unread,
    Aug 12, 2021, 3:41:13 PM8/12/21
    to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Attention is currently required from: Paschalis Tsilias, Michael Matloob.

    Paschalis Tsilias uploaded patch set #5 to this change.

    View Change

    cmd/go: add 'go mod vendor -o' flag

    Adds a new flag to 'go mod vendor' which overrides the default
    'vendor' destination directory. This can be helpful for writing the
    vendor tree to a temporary location for use by other tools.
    The argument can be a relative or an absolute path.
    This flag has no other influence on how the command behaves.

    Fixes #47327

    Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
    ---
    M src/cmd/go/alldocs.go
    M src/cmd/go/internal/modcmd/vendor.go
    M src/cmd/go/testdata/script/mod_vendor.txt
    3 files changed, 67 insertions(+), 4 deletions(-)

    To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
    Gerrit-Change-Number: 338149
    Gerrit-PatchSet: 5
    Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
    Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
    Gerrit-Reviewer: Go Bot <go...@golang.org>
    Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
    Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
    Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
    Gerrit-CC: Russ Cox <r...@golang.org>
    Gerrit-Attention: Paschalis Tsilias <paschali...@gmail.com>
    Gerrit-Attention: Michael Matloob <mat...@golang.org>
    Gerrit-MessageType: newpatchset

    Paschalis Tsilias (Gerrit)

    unread,
    Aug 12, 2021, 3:44:23 PM8/12/21
    to goph...@pubsubhelper.golang.org, Bryan C. Mills, Jay Conrod, Go Bot, Michael Matloob, Russ Cox, Ian Lance Taylor, golang-co...@googlegroups.com

    Attention is currently required from: Bryan C. Mills, Michael Matloob.

    View Change

    3 comments:

    • Patchset:

      • Patch Set #5:

        I realized that if this gets merged, we'd also need to update the reference page, but I couldn't it in a public repo.

    • File src/cmd/go/internal/modcmd/vendor.go:

      • I don't think this default matches the implementation in runVendor: outside of the root of the main […]

        You're right. The way that we've structured the condition, this default was never being used.

        If we can drop `vendorDirExplicit` then maybe we don't need to export ExplicitStringFlag after all. So, I've discarded the changes to the `base/flag.go`, used a plain StringVar flag and everything seems to work the same way.

    • File src/cmd/go/testdata/script/mod_vendor.txt:

      • Patch Set #4, Line 93:


        cd dir1
        go mod vendor -v -o relative-vendor-dir

        go mod vendor -v -o ../dir2/relative-vendor-dir

      • Also test the behavior of `-o ''` when in a subdirectory? (Right now we only seem to be testing it i […]

        I've added another testcase, it works on both latest patchsets.

    To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
    Gerrit-Change-Number: 338149
    Gerrit-PatchSet: 5
    Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
    Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
    Gerrit-Reviewer: Go Bot <go...@golang.org>
    Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
    Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
    Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
    Gerrit-CC: Russ Cox <r...@golang.org>
    Gerrit-Attention: Bryan C. Mills <bcm...@google.com>
    Gerrit-Attention: Michael Matloob <mat...@golang.org>
    Gerrit-Comment-Date: Thu, 12 Aug 2021 19:44:17 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Bryan C. Mills <bcm...@google.com>
    Gerrit-MessageType: comment

    Bryan C. Mills (Gerrit)

    unread,
    Aug 12, 2021, 4:13:52 PM8/12/21
    to Paschalis Tsilias, goph...@pubsubhelper.golang.org, Bryan C. Mills, Jay Conrod, Go Bot, Michael Matloob, Russ Cox, Ian Lance Taylor, golang-co...@googlegroups.com

    Attention is currently required from: Paschalis Tsilias, Michael Matloob.

    Patch set 5:Code-Review +2Trust +1

    View Change

      To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
      Gerrit-Change-Number: 338149
      Gerrit-PatchSet: 5
      Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
      Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
      Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
      Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
      Gerrit-CC: Russ Cox <r...@golang.org>
      Gerrit-Attention: Paschalis Tsilias <paschali...@gmail.com>
      Gerrit-Attention: Michael Matloob <mat...@golang.org>
      Gerrit-Comment-Date: Thu, 12 Aug 2021 20:13:46 +0000

      Jay Conrod (Gerrit)

      unread,
      Aug 17, 2021, 5:29:27 PM8/17/21
      to Paschalis Tsilias, goph...@pubsubhelper.golang.org, Bryan C. Mills, Go Bot, Michael Matloob, Russ Cox, Ian Lance Taylor, golang-co...@googlegroups.com

      Attention is currently required from: Paschalis Tsilias, Michael Matloob.

      Patch set 5:Code-Review +2Trust +1

      View Change

      1 comment:

      To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
      Gerrit-Change-Number: 338149
      Gerrit-PatchSet: 5
      Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
      Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
      Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
      Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
      Gerrit-CC: Russ Cox <r...@golang.org>
      Gerrit-Attention: Paschalis Tsilias <paschali...@gmail.com>
      Gerrit-Attention: Michael Matloob <mat...@golang.org>
      Gerrit-Comment-Date: Tue, 17 Aug 2021 21:29:23 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes

      Jay Conrod (Gerrit)

      unread,
      Aug 17, 2021, 5:31:09 PM8/17/21
      to Paschalis Tsilias, goph...@pubsubhelper.golang.org, Bryan C. Mills, Go Bot, Michael Matloob, Russ Cox, Ian Lance Taylor, golang-co...@googlegroups.com

      Attention is currently required from: Paschalis Tsilias, Michael Matloob.

      View Change

      1 comment:

      To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
      Gerrit-Change-Number: 338149
      Gerrit-PatchSet: 5
      Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
      Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
      Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
      Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
      Gerrit-CC: Russ Cox <r...@golang.org>
      Gerrit-Attention: Paschalis Tsilias <paschali...@gmail.com>
      Gerrit-Attention: Michael Matloob <mat...@golang.org>
      Gerrit-Comment-Date: Tue, 17 Aug 2021 21:31:05 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Go Bot <go...@golang.org>
      Gerrit-MessageType: comment

      Paschalis Tsilias (Gerrit)

      unread,
      Aug 20, 2021, 8:48:32 AM8/20/21
      to goph...@pubsubhelper.golang.org, Bryan C. Mills, Jay Conrod, Go Bot, Michael Matloob, Russ Cox, Ian Lance Taylor, golang-co...@googlegroups.com

      Attention is currently required from: Michael Matloob.

      View Change

      1 comment:

      To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
      Gerrit-Change-Number: 338149
      Gerrit-PatchSet: 5
      Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
      Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
      Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
      Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
      Gerrit-CC: Russ Cox <r...@golang.org>
      Gerrit-Attention: Michael Matloob <mat...@golang.org>
      Gerrit-Comment-Date: Fri, 20 Aug 2021 12:48:25 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No

      Paschalis Tsilias (Gerrit)

      unread,
      Nov 9, 2021, 4:40:00 PM11/9/21
      to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

      Attention is currently required from: Michael Matloob.

      Paschalis Tsilias uploaded patch set #6 to this change.

      View Change

      cmd/go: add 'go mod vendor -o' flag

      Adds a new flag to 'go mod vendor' which overrides the default
      'vendor' destination directory. This can be helpful for writing the
      vendor tree to a temporary location for use by other tools.
      The argument can be a relative or an absolute path.
      This flag has no other influence on how the command behaves.

      Fixes #47327

      Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
      ---
      M src/cmd/go/internal/modcmd/vendor.go
      M src/cmd/go/alldocs.go
      M src/cmd/go/testdata/script/mod_vendor.txt
      3 files changed, 83 insertions(+), 4 deletions(-)

      To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
      Gerrit-Change-Number: 338149
      Gerrit-PatchSet: 6
      Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
      Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
      Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
      Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
      Gerrit-CC: Russ Cox <r...@golang.org>
      Gerrit-Attention: Michael Matloob <mat...@golang.org>
      Gerrit-MessageType: newpatchset

      Paschalis Tsilias (Gerrit)

      unread,
      Nov 9, 2021, 4:42:49 PM11/9/21
      to goph...@pubsubhelper.golang.org, Bryan C. Mills, Go Bot, Michael Matloob, Russ Cox, Ian Lance Taylor, golang-co...@googlegroups.com

      Attention is currently required from: Michael Matloob.

      View Change

      1 comment:

      • Patchset:

        • Patch Set #6:

          After some recent changes in vendor.go I had to rebase and solve some conflicts. Could someone please just re-trigger the RunBots? (tests seems to pass locally though).

          I still need to mail a CL on https://go.googlesource.com/website to describe the new flag, and post the link here so they can be merged together?

      To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
      Gerrit-Change-Number: 338149
      Gerrit-PatchSet: 6
      Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
      Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
      Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
      Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
      Gerrit-CC: Russ Cox <r...@golang.org>
      Gerrit-Attention: Michael Matloob <mat...@golang.org>
      Gerrit-Comment-Date: Tue, 09 Nov 2021 21:42:43 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Gerrit-MessageType: comment

      Bryan C. Mills (Gerrit)

      unread,
      Nov 9, 2021, 5:10:39 PM11/9/21
      to Paschalis Tsilias, goph...@pubsubhelper.golang.org, Bryan C. Mills, Go Bot, Michael Matloob, Russ Cox, Ian Lance Taylor, golang-co...@googlegroups.com

      Attention is currently required from: Paschalis Tsilias, Michael Matloob.

      Patch set 6:Run-TryBot +1Code-Review +2Trust +1

      View Change

      1 comment:

      • File src/cmd/go/internal/modcmd/vendor.go:

        • Patch Set #6, Line 58: vendorDirValue

          (nit)

          s/vendorDirValue/vendorO/

          (for consistency with other flag variables in cmd/go)

      To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
      Gerrit-Change-Number: 338149
      Gerrit-PatchSet: 6
      Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
      Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
      Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
      Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
      Gerrit-CC: Russ Cox <r...@golang.org>
      Gerrit-Attention: Paschalis Tsilias <paschali...@gmail.com>
      Gerrit-Attention: Michael Matloob <mat...@golang.org>
      Gerrit-Comment-Date: Tue, 09 Nov 2021 22:10:34 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Gerrit-MessageType: comment

      Paschalis Tsilias (Gerrit)

      unread,
      Nov 9, 2021, 5:31:36 PM11/9/21
      to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

      Attention is currently required from: Paschalis Tsilias, Michael Matloob.

      Paschalis Tsilias uploaded patch set #7 to this change.

      View Change

      cmd/go: add 'go mod vendor -o' flag

      Adds a new flag to 'go mod vendor' which overrides the default
      'vendor' destination directory. This can be helpful for writing the
      vendor tree to a temporary location for use by other tools.
      The argument can be a relative or an absolute path.
      This flag has no other influence on how the command behaves.

      Fixes #47327

      Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
      ---
      M src/cmd/go/internal/modcmd/vendor.go
      M src/cmd/go/alldocs.go
      M src/cmd/go/testdata/script/mod_vendor.txt
      3 files changed, 83 insertions(+), 4 deletions(-)

      To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
      Gerrit-Change-Number: 338149
      Gerrit-PatchSet: 7
      Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
      Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
      Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
      Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
      Gerrit-CC: Russ Cox <r...@golang.org>
      Gerrit-Attention: Paschalis Tsilias <paschali...@gmail.com>
      Gerrit-Attention: Michael Matloob <mat...@golang.org>
      Gerrit-MessageType: newpatchset

      Paschalis Tsilias (Gerrit)

      unread,
      Nov 9, 2021, 5:32:12 PM11/9/21
      to goph...@pubsubhelper.golang.org, Go Bot, Bryan C. Mills, Michael Matloob, Russ Cox, Ian Lance Taylor, golang-co...@googlegroups.com

      Attention is currently required from: Michael Matloob.

      View Change

      1 comment:

      • File src/cmd/go/internal/modcmd/vendor.go:

        • (nit) […]

          Done

      To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
      Gerrit-Change-Number: 338149
      Gerrit-PatchSet: 6
      Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
      Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
      Gerrit-Reviewer: Go Bot <go...@golang.org>
      Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
      Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
      Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
      Gerrit-CC: Russ Cox <r...@golang.org>
      Gerrit-Attention: Michael Matloob <mat...@golang.org>
      Gerrit-Comment-Date: Tue, 09 Nov 2021 22:32:05 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No

      Bryan C. Mills (Gerrit)

      unread,
      Nov 9, 2021, 6:01:17 PM11/9/21
      to Paschalis Tsilias, goph...@pubsubhelper.golang.org, Bryan C. Mills, Go Bot, Michael Matloob, Russ Cox, Ian Lance Taylor, golang-co...@googlegroups.com

      Attention is currently required from: Paschalis Tsilias, Michael Matloob.

      Patch set 7:Run-TryBot +1Code-Review +2Trust +1

      View Change

        To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
        Gerrit-Change-Number: 338149
        Gerrit-PatchSet: 7
        Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
        Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
        Gerrit-Reviewer: Go Bot <go...@golang.org>
        Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
        Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
        Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
        Gerrit-CC: Russ Cox <r...@golang.org>
        Gerrit-Attention: Paschalis Tsilias <paschali...@gmail.com>
        Gerrit-Attention: Michael Matloob <mat...@golang.org>
        Gerrit-Comment-Date: Tue, 09 Nov 2021 23:01:13 +0000

        Paschalis Tsilias (Gerrit)

        unread,
        Nov 9, 2021, 6:02:27 PM11/9/21
        to goph...@pubsubhelper.golang.org, Bryan C. Mills, Go Bot, Michael Matloob, Russ Cox, Ian Lance Taylor, golang-co...@googlegroups.com

        Attention is currently required from: Paschalis Tsilias, Michael Matloob.

        View Change

        1 comment:

        To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
        Gerrit-Change-Number: 338149
        Gerrit-PatchSet: 7
        Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
        Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
        Gerrit-Reviewer: Go Bot <go...@golang.org>
        Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
        Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
        Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
        Gerrit-CC: Russ Cox <r...@golang.org>
        Gerrit-Attention: Paschalis Tsilias <paschali...@gmail.com>
        Gerrit-Attention: Michael Matloob <mat...@golang.org>
        Gerrit-Comment-Date: Tue, 09 Nov 2021 23:02:20 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Gerrit-MessageType: comment

        Bryan C. Mills (Gerrit)

        unread,
        Nov 10, 2021, 4:14:12 PM11/10/21
        to Paschalis Tsilias, goph...@pubsubhelper.golang.org, Go Bot, Bryan C. Mills, Michael Matloob, Russ Cox, Ian Lance Taylor, golang-co...@googlegroups.com

        Attention is currently required from: Paschalis Tsilias, Michael Matloob.

        Bryan C. Mills removed a vote from this change.

        View Change

        Removed Run-TryBot+1 by Bryan C. Mills <bcm...@google.com>

        To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
        Gerrit-Change-Number: 338149
        Gerrit-PatchSet: 7
        Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
        Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
        Gerrit-Reviewer: Go Bot <go...@golang.org>
        Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
        Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
        Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
        Gerrit-CC: Russ Cox <r...@golang.org>
        Gerrit-Attention: Paschalis Tsilias <paschali...@gmail.com>
        Gerrit-Attention: Michael Matloob <mat...@golang.org>
        Gerrit-MessageType: deleteVote

        Bryan C. Mills (Gerrit)

        unread,
        Nov 10, 2021, 4:14:13 PM11/10/21
        to Paschalis Tsilias, goph...@pubsubhelper.golang.org, Go Bot, Bryan C. Mills, Michael Matloob, Russ Cox, Ian Lance Taylor, golang-co...@googlegroups.com

        Attention is currently required from: Paschalis Tsilias, Michael Matloob.

        Bryan C. Mills removed a vote from this change.

        View Change

        Removed TryBot-Result+1 by Go Bot <go...@golang.org>

        Bryan C. Mills (Gerrit)

        unread,
        Nov 10, 2021, 4:14:23 PM11/10/21
        to Paschalis Tsilias, goph...@pubsubhelper.golang.org, Go Bot, Bryan C. Mills, Michael Matloob, Russ Cox, Ian Lance Taylor, golang-co...@googlegroups.com

        Attention is currently required from: Paschalis Tsilias, Michael Matloob.

        Patch set 7:Run-TryBot +1

        View Change

        1 comment:

        To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
        Gerrit-Change-Number: 338149
        Gerrit-PatchSet: 7
        Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
        Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
        Gerrit-Reviewer: Go Bot <go...@golang.org>
        Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
        Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
        Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
        Gerrit-CC: Russ Cox <r...@golang.org>
        Gerrit-Attention: Paschalis Tsilias <paschali...@gmail.com>
        Gerrit-Attention: Michael Matloob <mat...@golang.org>
        Gerrit-Comment-Date: Wed, 10 Nov 2021 21:14:18 +0000

        Bryan C. Mills (Gerrit)

        unread,
        Nov 10, 2021, 4:32:56 PM11/10/21
        to Bryan C. Mills, Paschalis Tsilias, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Go Bot, Michael Matloob, Russ Cox, Ian Lance Taylor, golang-co...@googlegroups.com

        Bryan C. Mills submitted this change.

        View Change


        Approvals: Bryan C. Mills: Looks good to me, approved; Trusted; Run TryBots Jay Conrod: Looks good to me, approved; Trusted Go Bot: TryBots succeeded
        cmd/go: add 'go mod vendor -o' flag

        Adds a new flag to 'go mod vendor' which overrides the default
        'vendor' destination directory. This can be helpful for writing the
        vendor tree to a temporary location for use by other tools.
        The argument can be a relative or an absolute path.
        This flag has no other influence on how the command behaves.

        Fixes #47327

        Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
        Reviewed-on: https://go-review.googlesource.com/c/go/+/338149
        Reviewed-by: Bryan C. Mills <bcm...@google.com>
        Reviewed-by: Jay Conrod <jayc...@google.com>
        Trust: Bryan C. Mills <bcm...@google.com>
        Trust: Jay Conrod <jayc...@google.com>
        Run-TryBot: Bryan C. Mills <bcm...@google.com>
        TryBot-Result: Go Bot <go...@golang.org>

        ---
        M src/cmd/go/internal/modcmd/vendor.go
        M src/cmd/go/alldocs.go
        M src/cmd/go/testdata/script/mod_vendor.txt
        3 files changed, 90 insertions(+), 4 deletions(-)

        diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go
        index 81d2f70..ff144f9 100644
        --- a/src/cmd/go/alldocs.go
        +++ b/src/cmd/go/alldocs.go
        @@ -1295,7 +1295,7 @@
        //
        // Usage:
        //
        -// go mod vendor [-e] [-v]
        +// go mod vendor [-e] [-v] [-o outdir]
        //
        // Vendor resets the main module's vendor directory to include all packages
        // needed to build and test all the main module's packages.
        @@ -1307,6 +1307,11 @@
        // 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.
        +//
        // See https://golang.org/ref/mod#go-mod-vendor for more about 'go mod vendor'.
        //
        //
        diff --git a/src/cmd/go/internal/modcmd/vendor.go b/src/cmd/go/internal/modcmd/vendor.go
        index 484e095..ef12370 100644
        --- a/src/cmd/go/internal/modcmd/vendor.go
        +++ b/src/cmd/go/internal/modcmd/vendor.go
        @@ -31,7 +31,7 @@
        )

        var cmdVendor = &base.Command{
        - UsageLine: "go mod vendor [-e] [-v]",
        + UsageLine: "go mod vendor [-e] [-v] [-o outdir]",
        Short: "make vendored copy of dependencies",
        Long: `
        Vendor resets the main module's vendor directory to include all packages
        @@ -44,16 +44,23 @@
        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.
        +
        See https://golang.org/ref/mod#go-mod-vendor for more about 'go mod vendor'.
        `,
        Run: runVendor,
        }

        -var vendorE bool // if true, report errors but proceed anyway
        +var vendorE bool // if true, report errors but proceed anyway
        +var vendorO string // if set, overrides the default output directory

        func init() {
        cmdVendor.Flag.BoolVar(&cfg.BuildV, "v", false, "")
        cmdVendor.Flag.BoolVar(&vendorE, "e", false, "")
        + cmdVendor.Flag.StringVar(&vendorO, "o", "", "")
        base.AddModCommonFlags(&cmdVendor.Flag)
        }

        @@ -74,7 +81,15 @@
        }
        _, pkgs := modload.LoadPackages(ctx, loadOpts, "all")

        - vdir := filepath.Join(modload.VendorDir())
        + var vdir string
        + switch {
        + case filepath.IsAbs(vendorO):
        + vdir = vendorO
        + case vendorO != "":
        + vdir = filepath.Join(base.Cwd(), vendorO)
        + default:
        + vdir = filepath.Join(modload.VendorDir())
        + }
        if err := os.RemoveAll(vdir); err != nil {
        base.Fatalf("go: %v", err)
        }
        diff --git a/src/cmd/go/testdata/script/mod_vendor.txt b/src/cmd/go/testdata/script/mod_vendor.txt
        index 4eb80c2..a2727dd 100644
        --- a/src/cmd/go/testdata/script/mod_vendor.txt
        +++ b/src/cmd/go/testdata/script/mod_vendor.txt
        @@ -82,6 +82,48 @@
        ! exists vendor/x/x2
        ! exists vendor/x/x2/LICENSE

        +# 'go mod vendor' should work with an alternative vendor directory if the -o flag is provided.
        +go mod vendor -v -o alternative-vendor-dir
        +exists alternative-vendor-dir/modules.txt
        +exists alternative-vendor-dir/a/foo/LICENSE
        +
        +# 'go mod vendor' should interpret paths relative to the current working directory when the -o flag is provided.
        +mkdir dir1
        +mkdir dir2
        +
        +cd dir1
        +go mod vendor -v -o relative-vendor-dir
        +
        +go mod vendor -v -o ../dir2/relative-vendor-dir
        +
        +cd ..
        +exists dir1/relative-vendor-dir/modules.txt
        +exists dir1/relative-vendor-dir/a/foo/LICENSE
        +exists dir2/relative-vendor-dir/modules.txt
        +exists dir2/relative-vendor-dir/a/foo/LICENSE
        +
        +# 'go mod vendor' should fall back to the default 'vendor' directory when an empty argument is passed to the -o flag
        +# the same behavior should be exhibited both on the module root directory, as well as nested subdirectories
        +
        +go mod vendor -v -o ''
        +exists vendor/modules.txt
        +
        +env GOFLAGS=-o=foo
        +go mod vendor -v -o ''
        +exists vendor/modules.txt
        +env GOFLAGS=''
        +
        +mkdir -p nested/dir
        +cd nested/dir
        +go mod vendor -v -o ''
        +! exists vendor/
        +exists ../../vendor/modules.txt
        +cd ../..
        +
        +# 'go mod vendor' should work with absolute paths as well
        +go mod vendor -v -o $WORK/tmp/absolute-vendor-dir
        +exists $WORK/tmp/absolute-vendor-dir/modules.txt
        +
        [short] stop

        # 'go build' and 'go test' using vendored packages should succeed.

        To view, visit change 338149. To unsubscribe, or for help writing mail filters, visit settings.

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
        Gerrit-Change-Number: 338149
        Gerrit-PatchSet: 8
        Gerrit-Owner: Paschalis Tsilias <paschali...@gmail.com>
        Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
        Gerrit-Reviewer: Go Bot <go...@golang.org>
        Gerrit-Reviewer: Jay Conrod <jayc...@google.com>
        Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
        Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
        Gerrit-CC: Russ Cox <r...@golang.org>
        Gerrit-MessageType: merged
        Reply all
        Reply to author
        Forward
        0 new messages