<p>Hi all. I just started at a new company that's been using Go since '13 - before vendoring and standard directory structures. Their structure is a bit backwards from the standard structure, but we want to fix it.</p>
<p>Our code is all stored in <code>$GOPATH/[project]/src/[company]/[package]</code>.</p>
<p>Ex. <code>~/dev/myproject/src/acmecorp/mypackage</code></p>
<p>I'd like to re-org everything to be more standardized and switch to use dep.</p>
<p>My question is this. Is it common practice to put <em>your</em> code in <code>$GOPATH/src/github.com/company/project/package</code>? Or can we skip the "github.com" part and just use <code>$GOPATH/src/company/project/package</code>?</p>
<p>What problems or issues would we be getting ourselves into if we did that?</p>
<p>Thanks in advanced</p>
<hr/>**评论:**<br/><br/>insanelygreat: <pre><p>To quote the docs:</p>
<blockquote>
<p>In practice you can choose any arbitrary path name, as long as it is unique to the standard library and greater Go ecosystem.</p>
</blockquote>
<p>However, you lose the ability to <code>go get</code> packages you don't have.</p>
<p>EDIT: <a href="https://golang.org/doc/articles/go_command.html#tmp_2" rel="nofollow">You'll probably find this helpful.</a></p></pre>sheepdog69: <pre><p>So, it would make sense to put any shared code into the full path (github.com/blah/blah)? So it's easier to use between projects?</p></pre>insanelygreat: <pre><p>I know it's verbose, but I'd suggest putting everything under the domain. You'll be glad you did later.</p>
<p>In case you missed my edit: <a href="https://golang.org/doc/articles/go_command.html#tmp_2" rel="nofollow">This section of the docs</a> explains the rationale.</p></pre>sheepdog69: <pre><p>That's for the feedback. I'll take a look at the link now.</p>
<p>I definitely want to do it "right" from the beginning.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传