What am I supposed to do with a Gopkg.toml file?

agolangf · · 743 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Want to build this app, <a href="https://github.com/tj/gh-polls" rel="nofollow">gh-poll</a>, without installing it from Github. Can&#39;t find much information on what commands to run to install the dependencies automatically</p> <hr/>**评论:**<br/><br/>pierrrre: <pre><p><a href="https://github.com/golang/dep" rel="nofollow">https://github.com/golang/dep</a></p></pre>Saltones: <pre><p>How did people install dependencies before this? Seems like one of the first things you&#39;d think off when designing a language</p> <p><strong>edit:</strong></p> <p>I&#39;m getting this error:</p> <pre><code>gh-polls is not within a known GOPATH </code></pre> <p>Tried:</p> <pre><code>dep ensure dep ensure --update </code></pre></pre>robvdl: <pre><p>Sounds like you didn&#39;t clone gh-poll into $GOPATH/src</p> <p>If your GOPATH and GOROOT environment variables are setup properly, you should be able to clone gh-poll like this:</p> <p>go get github.com/tj/gh-polls</p> <p>It will place it in $GOPATH/src/github.com/tj/gh-polls</p> <p>If you don&#39;t place things in $GOPATH/src they generally won&#39;t compile.</p></pre>robvdl: <pre><p>Interestingly we had a work on any opensource project day last Friday at work and I decided to take on teaching a few people Go and doing a small project in Go.</p> <p>This had to be the number one thing people complained the loudest about, they didn&#39;t really agree with having to clone projects into this special path structure.</p> <p>The other thing that came up was people getting go1.6 from apt, rather than downloading go1.8 from golang.org. Off course 1.6 wasn&#39;t going to work when we planned to use chi.</p></pre>Saltones: <pre><p>Does the guy developing the package also have to work from <code>$GOPATH</code>?</p></pre>robvdl: <pre><p>Yes</p></pre>vldo: <pre><p><a href="https://www.reddit.com/r/golang/comments/6m8kzw/what_am_i_supposed_to_do_with_a_gopkgtoml_file/djzueqe/" rel="nofollow">robvdl</a>&#39;s suggestion is correct</p> <p>Make sure you have everything <a href="https://golang.org/doc/code.html#GOPATH" rel="nofollow">setup</a></p></pre>dlsniper: <pre><p>What does a language design have to do with dependency management for it?</p></pre>Saltones: <pre><p>Design/tooling</p></pre>dlsniper: <pre><p>You seem to mix a programming language design with a tooling design. They have nothing in common (as a proof we have go-gradle which allows you to use Gradle to handle Go dependencies). </p></pre>ChristophBerger: <pre><blockquote> <p>(...) without installing it from Github.</p> </blockquote> <p><code>go get -d</code> may be what you are looking for. With the <code>-d</code> switch, go get downloads a project into your GOPATH but does not install it. <code>go dep</code> should then work fine and fetch the required dependencies.</p></pre>robvdl: <pre><p>That&#39;s because the author decided to git ignore the vendor dir.</p></pre>ChristophBerger: <pre><p>Indeed, as can be seen by the absence of a vendor directory in the repository.</p></pre>dz0ny: <pre><p>and that is correct.</p></pre>ChristophBerger: <pre><p>Good to see<br/> that we all agree</p></pre>

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

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