Why can go get -u not fetch these two dependencies?

blov · · 508 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>When I ran <a href="https://github.com/knq/usql"><code>go get -u https://github.com/knq/usql</code></a>, trying to install a program that was recently posted here, I received these error messages:</p> <pre><code>package github.com/go-sql-driver/mysql: remote origin not found package github.com/lib/pq: remote origin not found </code></pre> <p>I could <code>go get</code> each of these packages manually, but I still got the error messages when running the above command. So I went into the appropriate directories (<code>$GOPATH/src/github.com/lib</code> and <code>$GOPATH/src/github.com/go-sql-driver/mysql</code>), deleted everything, and then ran <code>git clone https://github.com/go-sql-driver/mysql.git</code> etcetera. Now <code>go get -u</code> runs fine.</p> <p>What&#39;s going on here? Are repositories required to specify their origin in some settings file so <code>go get</code> can locate it?</p> <hr/>**评论:**<br/><br/>ar1819: <pre><p>Add -v and -x flags so you could at least see what&#39;s happening. </p></pre>Fwippy: <pre><p>I&#39;m not sure. It Worked On My Machine just now - perhaps you had a momentary network hiccup?</p></pre>NeverUse-YouPromised: <pre><p>It happened on two separate occasions and is reliably reproducible. I don&#39;t think my network has anything to do with it.</p></pre>j_d_q: <pre><p>Might you have removed the .git folder? From the error, it appears they can&#39;t find where to fetch from</p></pre>NeverUse-YouPromised: <pre><p>I didn&#39;t touch the repositories; I just let Go do its thing. After the command of paragraph 1, I ran <code>git status</code> to check the repositories and they weren&#39;t git repositories. It&#39;s as if <code>go get</code> just raw-downloaded the files.</p></pre>PsyWolf: <pre><p>In that case, the easiest thing to do would be to just delete those packages from your GOPATH and then the commands should work as expected. </p> <p>Not sure how/why the .git folder isn&#39;t there. The go tool always does a normal clone afaik.</p></pre>NeverUse-YouPromised: <pre><p>Like I said in the question, I did, and when I did that, it worked. However, if I delete the dependencies and run <code>go get -u</code> on the original project, the problem re-appears.</p> <p>Edit: and somehow it doesn&#39;t now. What a weird problem.</p></pre>PsyWolf: <pre><p>It&#39;s possible some other tool like godep or glide might be pruning out unnecessary files including the .git folder? It wouldn&#39;t be the weirdest feature ever.</p></pre>NeverUse-YouPromised: <pre><p>I don&#39;t use any dependency tool.</p></pre>

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

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