Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: go 1.7 get does not clone git submodules #16165

Closed
SpComb opened this issue Jun 23, 2016 · 2 comments
Closed

cmd/go: go 1.7 get does not clone git submodules #16165

SpComb opened this issue Jun 23, 2016 · 2 comments
Milestone

Comments

@SpComb
Copy link

SpComb commented Jun 23, 2016

I suspect the changes to src/cmd/go/vcs.go to remove the go15VendorExperiment are not correct. Instead of skipping the git submodule commands when the vendor experiment is disabled, it now unconditionally skips them: 3e23442#diff-fb7e1ef0d86138e83d8f1debd67eaf06

This is a regression from Go 1.6.

  1. What version of Go are you using (go version)?

    go version go1.7beta2 linux/amd64
    
  2. What operating system and processor architecture are you using (go env)?

    GOARCH="amd64"
    GOBIN=""
    GOEXE=""
    GOHOSTARCH="amd64"
    GOHOSTOS="linux"
    GOOS="linux"
    GOPATH="/root/go"
    GORACE=""
    GOROOT="/usr/local/go"
    GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
    CC="gcc"
    GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
    CXX="g++"
    CGO_ENABLED="1"
    
  3. What did you do?

    $ go get -v -u github.com/qmsk/e2/cmd/tally
    github.com/qmsk/e2 (download)
    github.com/jessevdk/go-flags (download)
    github.com/kidoman/embd (download)
    github.com/golang/glog (download)
    github.com/qmsk/e2/discovery
    github.com/qmsk/e2/client
    github.com/qmsk/e2/tally
    github.com/qmsk/e2/cmd/tally
    
  4. What did you expect to see?

    I expected the git submodules within my vendor/ directory to be present:

    $ cat src/github.com/qmsk/e2/.gitmodules 
    [submodule "vendor/github.com/kidoman/embd"]
            path = vendor/github.com/kidoman/embd
            url = git@github.com:SpComb/embd.git
            branch = digitalpin-exported
    
  5. What did you see instead?

    go get did not clone the git submodules.

    $ ls -la src/github.com/qmsk/e2/vendor/github.com/kidoman/embd/
    total 0
    drwxr-xr-x 1 root root 0 Jun 23 13:28 .
    drwxr-xr-x 1 root root 8 Jun 23 13:28 ..
    
@SpComb
Copy link
Author

SpComb commented Jun 23, 2016

I can confirm that with the following patch:

diff --git a/src/cmd/go/vcs.go b/src/cmd/go/vcs.go
index f7c34de..df37c1a 100644
--- a/src/cmd/go/vcs.go
+++ b/src/cmd/go/vcs.go
@@ -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
            }

go get does succesfully clone the git submodules:

$ GOPATH=~/go /root/src/go/bin/go get -v -u github.com/qmsk/e2/cmd/tally
github.com/qmsk/e2 (download)
github.com/jessevdk/go-flags (download)
github.com/golang/glog (download)
github.com/jessevdk/go-flags
github.com/qmsk/e2/discovery
github.com/golang/glog
github.com/qmsk/e2/client
github.com/qmsk/e2/vendor/github.com/kidoman/embd
github.com/qmsk/e2/vendor/github.com/kidoman/embd/host/generic
github.com/qmsk/e2/vendor/github.com/kidoman/embd/host/rpi
github.com/qmsk/e2/tally
github.com/qmsk/e2/cmd/tally

This behavior matches what Go 1.6 does.

@bradfitz bradfitz changed the title go 1.7 get does not clone git submodules cmd/go: go 1.7 get does not clone git submodules Jun 23, 2016
@bradfitz bradfitz added this to the Go1.7Maybe milestone Jun 23, 2016
@adg adg self-assigned this Jun 27, 2016
@adg adg modified the milestones: Go1.7, Go1.7Maybe Jun 28, 2016
@gopherbot
Copy link

CL https://golang.org/cl/24531 mentions this issue.

@golang golang locked and limited conversation to collaborators Jun 28, 2017
@rsc rsc unassigned adg Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants