Is there a way to redownload sources for all installed packages in src if it is empty?

blov · · 479 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I have removed all source directories in src on the suggestion of a developer to fix a git error, however it doesn&#39;t seem like <code>go get</code> keeps a list of the links of all installed packages so <code>go get -u all</code> doesn&#39;t work anymore. Is there any way to redownload the sources of all installed packages?</p> <hr/>**评论:**<br/><br/>kisielk: <pre><p>In <code>$GOPATH/pkg/</code> there&#39;s a tree of subdirectories of previously compiled packages. You can write a script or program to walk this tree and reassemble all the original import paths.</p></pre>pappogeomys: <pre><p>You&#39;ve removed the closest thing there is to a list of the installed packages. Just <code>go get</code> new packages as needed. </p></pre>greenreflection: <pre><p>This was my fear. It&#39;s a bit disappointing.</p></pre>pappogeomys: <pre><p>What exactly are you concerned with? I&#39;ve started with an empty GOPATH countless times. If you never notice that you&#39;re missing a package you once had, are you really missing it? </p></pre>greenreflection: <pre><p>Well, the only issue is <code>go get -u all</code> not working and getting stuck with old packages.</p></pre>pappogeomys: <pre><p>You&#39;re not stuck with old packages, because you don&#39;t have them any more. Even the very rare binary-only packages require a source file. Anything you build will require fetching the source, which will get you the same thing as <code>go get -u</code>. </p> <p>Dependencies should be managed carefully, not just with blanket updates. In almost 5 years of writing Go professionally, I&#39;ve never once used <code>go get -u all</code>. </p></pre>BaconBytes42: <pre><p>yeah use dep</p></pre>greenreflection: <pre><p>Isn&#39;t dep for managing dependencies of a single package and not managing all packages in $GOPATH/src?</p></pre>BaconBytes42: <pre><p>True. Have to have a reference to what you want/need. If there are no files there, nothing is going to know what you had.</p> <p>Maybe write up a script to dep each project you have and install globally?</p></pre>

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

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