diff --git a/src/cmd/go/vcs.go b/src/cmd/go/vcs.go index 946b6ae7bf..743205bfd8 100644 --- a/src/cmd/go/vcs.go +++ b/src/cmd/go/vcs.go @@ -122,7 +122,7 @@ var vcsGit = &vcsCmd{ name: "Git", cmd: "git", - createCmd: []string{"clone {repo} {dir}", "--git-dir={dir}/.git submodule update --init --recursive"}, + createCmd: []string{"clone {repo} {dir}", "-C {dir} submodule update --init --recursive"}, downloadCmd: []string{"pull --ff-only", "submodule update --init --recursive"}, tagCmd: []tagCmd{ diff --git a/src/cmd/go/vendor_test.go b/src/cmd/go/vendor_test.go index 766392fe3a..ed73be36a8 100644 --- a/src/cmd/go/vendor_test.go +++ b/src/cmd/go/vendor_test.go @@ -187,6 +187,18 @@ func TestVendorGetUpdate(t *testing.T) { tg.run("get", "-u", "github.com/rsc/go-get-issue-11864") } +func TestGetSubmodules(t *testing.T) { + testenv.MustHaveExternalNetwork(t) + + tg := testgo(t) + defer tg.cleanup() + tg.makeTempdir() + tg.setenv("GOPATH", tg.path(".")) + tg.setenv("GO15VENDOREXPERIMENT", "1") + tg.run("get", "-d", "github.com/rsc/go-get-issue-12612") + tg.run("get", "-u", "-d", "github.com/rsc/go-get-issue-12612") +} + func TestVendorCache(t *testing.T) { tg := testgo(t) defer tg.cleanup()