<p dir="auto">As per <a href="https://groups.google.com/forum/#!topic/golang-nuts/XNJ_vfai9Io" rel="nofollow">golang-nuts</a>:</p>
<p dir="auto">I am trying to get vendoring working with submodules which is supposed to be working according to <a href="https://docs.google.com/document/d/1Bz5-UB7g2uPBdOx-rw5t9MxJwkfpx90cqG9AFL0JAYo/edit" rel="nofollow">s/go15vender</a>. The building part works fine but the "go get" part doesn't.</p>
<p dir="auto">To reproduce I created a test <a href="https://github.com/StephanDollberg/govendorsubmodulestest">repo</a> by doing the following:</p>
<p dir="auto">Created a test package and added a submodule via:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" git submodule add https://github.com/dgrijalva/jwt-go vendor/github.com/dgrijalva/jwt-go"><pre class="notranslate"><code class="notranslate"> git submodule add https://github.com/dgrijalva/jwt-go vendor/github.com/dgrijalva/jwt-go
</code></pre></div>
<p dir="auto">Committed everything.</p>
<p dir="auto">Now, if I do:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="GO15VENDOREXPERIMENT=1 go get github.com/StephanDollberg/govendorsubmodulestest"><pre class="notranslate"><code class="notranslate">GO15VENDOREXPERIMENT=1 go get github.com/StephanDollberg/govendorsubmodulestest
</code></pre></div>
<p dir="auto">I get the error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="# cd .; git --git-dir=/$GOPATH/src/github.com/StephanDollberg/govendorsubmodulestest/.git submodule update --init --recursive
No submodule mapping found in .gitmodules for path 'vendor/github.com/dgrijalva/jwt-go'
package github.com/StephanDollberg/govendorsubmodulestest: exit status 1"><pre class="notranslate"><code class="notranslate"># cd .; git --git-dir=/$GOPATH/src/github.com/StephanDollberg/govendorsubmodulestest/.git submodule update --init --recursive
No submodule mapping found in .gitmodules for path 'vendor/github.com/dgrijalva/jwt-go'
package github.com/StephanDollberg/govendorsubmodulestest: exit status 1
</code></pre></div>
<p dir="auto">The interesting thing is that if I do a go get -u after that it checks out the submodule correctly. Looking at the error and the source of the go command I think it has to do with --git-dir not working together with the submodule command.</p>
<p dir="auto">I tested this on Windows, Mac OSX and Linux (all Intel 64bit)  with go 1.5.1 and several git versions (2.3, 2.4, 2.5).</p>
<p dir="auto">The <a href="https://github.com/golang/go/blob/b9dbb030d5e7d2733e877972568368dc806b7304/src/cmd/go/vcs.go#L125"><code class="notranslate">createCmd</code></a> for the submodules fails. I have clarified <a href="http://thread.gmane.org/gmane.comp.version-control.git/277630/focus=277825" rel="nofollow">upstream</a> if this is expected to fail. The result is that it is expected to fail as it is currently in the code. The correct <code class="notranslate">createCmd</code> therefore would be:</p>
<div class="highlight highlight-source-go notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="createCmd: []string{&quot;clone {repo} {dir}&quot;, &quot;-C={dir} submodule update --init --recursive&quot;}"><pre class="notranslate">createCmd: []<span class="pl-smi">string</span>{<span class="pl-s">"clone {repo} {dir}"</span>, <span class="pl-s">"-C={dir} submodule update --init --recursive"</span>}</pre></div>