]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: restore support for git submodules and update docs
authorAndrew Gerrand <adg@golang.org>
Tue, 28 Jun 2016 08:09:56 +0000 (18:09 +1000)
committerAndrew Gerrand <adg@golang.org>
Tue, 28 Jun 2016 21:36:47 +0000 (21:36 +0000)
Fixes #16165

Change-Id: Ic90e5873e0c8ee044f09543177192dcae1dcdbed
Reviewed-on: https://go-review.googlesource.com/24531
Run-TryBot: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/go/alldocs.go
src/cmd/go/get.go
src/cmd/go/go_test.go
src/cmd/go/help.go
src/cmd/go/vcs.go
src/cmd/go/vendor_test.go

index 91875616ce5fb893cd068a17c80435657c70e2a3..58b0d16b2b0af951e69180cf3500b4510d4ef839 100644 (file)
 // searches for a branch or tag named "go1". If no such version exists it
 // retrieves the most recent version of the package.
 //
-// Unless vendoring support is disabled (see 'go help gopath'),
-// when go get checks out or updates a Git repository,
+// When go get checks out or updates a Git repository,
 // it also updates any git submodules referenced by the repository.
 //
 // Get never checks out or updates code stored in vendor directories.
 // let package authors make sure the custom import path is used and not a
 // direct path to the underlying code hosting site.
 //
-// If vendoring is enabled (see 'go help gopath'), then import path checking is
-// disabled for code found within vendor trees. This makes it possible to copy
-// code into alternate locations in vendor trees without needing to update import
-// comments.
+// Import path checking is disabled for code found within vendor trees.
+// This makes it possible to copy code into alternate locations in vendor trees
+// without needing to update import comments.
 //
 // See https://golang.org/s/go14customimport for details.
 //
index 969760a77e7b1d8e2f0dc8dd144a45043914107e..19858f7e55db928bbaaef5961f2229f59a1f9bdd 100644 (file)
@@ -55,8 +55,7 @@ rule is that if the local installation is running version "go1", get
 searches for a branch or tag named "go1". If no such version exists it
 retrieves the most recent version of the package.
 
-Unless vendoring support is disabled (see 'go help gopath'),
-when go get checks out or updates a Git repository,
+When go get checks out or updates a Git repository,
 it also updates any git submodules referenced by the repository.
 
 Get never checks out or updates code stored in vendor directories.
index 0529d7fb311e53a92897237748174f5d055079e0..66c641347cb27b5e8fd68d7aaf282c354b64a07b 100644 (file)
@@ -489,6 +489,16 @@ func (tg *testgoData) path(name string) string {
        return filepath.Join(tg.tempdir, name)
 }
 
+// mustExist fails if path does not exist.
+func (tg *testgoData) mustExist(path string) {
+       if _, err := os.Stat(path); err != nil {
+               if os.IsNotExist(err) {
+                       tg.t.Fatalf("%s does not exist but should", path)
+               }
+               tg.t.Fatalf("%s stat failed: %v", path, err)
+       }
+}
+
 // mustNotExist fails if path exists.
 func (tg *testgoData) mustNotExist(path string) {
        if _, err := os.Stat(path); err == nil || !os.IsNotExist(err) {
index 34bd80dc92c48595ec4aa5938b7b2e1cad138f76..056a0af1125b6ed6688577199caae17013a1d7cd 100644 (file)
@@ -261,10 +261,9 @@ unless it is being referred to by that import path. In this way, import comments
 let package authors make sure the custom import path is used and not a
 direct path to the underlying code hosting site.
 
-If vendoring is enabled (see 'go help gopath'), then import path checking is
-disabled for code found within vendor trees. This makes it possible to copy
-code into alternate locations in vendor trees without needing to update import
-comments.
+Import path checking is disabled for code found within vendor trees.
+This makes it possible to copy code into alternate locations in vendor trees
+without needing to update import comments.
 
 See https://golang.org/s/go14customimport for details.
        `,
index f7c34de5762be244e28be21c5013465e64664dac..df37c1a1f12c300eff70a87e7f58627dda1e32ed 100644 (file)
@@ -383,9 +383,6 @@ func (v *vcsCmd) ping(scheme, repo string) error {
 // The parent of dir must exist; dir must not.
 func (v *vcsCmd) create(dir, repo string) error {
        for _, cmd := range v.createCmd {
-               if strings.Contains(cmd, "submodule") {
-                       continue
-               }
                if err := v.run(".", cmd, "dir", dir, "repo", repo); err != nil {
                        return err
                }
@@ -396,9 +393,6 @@ func (v *vcsCmd) create(dir, repo string) error {
 // download downloads any new changes for the repo in dir.
 func (v *vcsCmd) download(dir string) error {
        for _, cmd := range v.downloadCmd {
-               if strings.Contains(cmd, "submodule") {
-                       continue
-               }
                if err := v.run(dir, cmd); err != nil {
                        return err
                }
@@ -445,9 +439,6 @@ func (v *vcsCmd) tagSync(dir, tag string) error {
 
        if tag == "" && v.tagSyncDefault != nil {
                for _, cmd := range v.tagSyncDefault {
-                       if strings.Contains(cmd, "submodule") {
-                               continue
-                       }
                        if err := v.run(dir, cmd); err != nil {
                                return err
                        }
@@ -456,9 +447,6 @@ func (v *vcsCmd) tagSync(dir, tag string) error {
        }
 
        for _, cmd := range v.tagSyncCmd {
-               if strings.Contains(cmd, "submodule") {
-                       continue
-               }
                if err := v.run(dir, cmd, "tag", tag); err != nil {
                        return err
                }
index e3070e8e4508a2378fcd675a2a6ff17555feee58..226b5377b985b835e72051cb61eb3deab1faee9b 100644 (file)
@@ -197,6 +197,7 @@ func TestGetSubmodules(t *testing.T) {
        tg.setenv("GOPATH", tg.path("."))
        tg.run("get", "-d", "github.com/rsc/go-get-issue-12612")
        tg.run("get", "-u", "-d", "github.com/rsc/go-get-issue-12612")
+       tg.mustExist(tg.path("src/github.com/rsc/go-get-issue-12612/vendor/golang.org/x/crypto/.git"))
 }
 
 func TestVendorCache(t *testing.T) {