Is there a way to force `go get` to always do a shallow clone?

blov · · 508 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<hr/>**评论:**<br/><br/>qu33ksilver: <pre><p>Nope. This was done once, and then rolled back. <a href="https://github.com/golang/go/issues/13078" rel="nofollow">https://github.com/golang/go/issues/13078</a>.</p></pre>dlsniper: <pre><p>No. But you can duplicate what go get does by doing <code>mkdir -p dir/name &amp;&amp; cd dir/name &amp;&amp; git clone --depth=1 repo .</code></p></pre>FullTimePhilosopher: <pre><p>Correct, you just missed <code>go install</code> =)</p></pre>dlsniper: <pre><p>Not really needed after the first compilation in the Go 1.10+ world, but yes. </p></pre>qrv3w: <pre><p>What do you suggest for doing &#34;go get ./...&#34; inside a repo to install dependencies in a shallow way?</p></pre>qrv3w: <pre><p>I&#39;ll answer my own question. Here&#39;s <a href="https://github.com/schollz/git-shallow" rel="nofollow">a &lt;30 line program that wraps git</a>. So you can just do:</p> <p><code> $ go get github.com/schollz/git $ export PATH=$GOPATH/bin:$PATH </code></p> <p>which will set <code>depth==1</code> whenever you do a pull/clone with git.</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

508 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传