<p>Go need absolute paths for importing files <code>/github.com/urs/prjct</code>
This is fine and good for utility libraries (JWT, encryption, image compression). Until you want to make a "starter" style project.
These proejcts are typically forked and directly worked on while changing their proejct names and github user.
This will break the absoule import paths and they would need to manaully change all paths that refer to the project its self.</p>
<p>What solutions do you guys see to this problem?</p>
<hr/>**评论:**<br/><br/>0xjnml: <pre><blockquote>
<p>Go need absolute paths for importing files <code>/github.com/urs/prjct</code></p>
</blockquote>
<p>No, <code>go build</code> does not need absolute paths. Import paths are interpreted relative to <code>$GOPATH/src</code>.</p></pre>LVCXD: <pre><p><a href="https://golang.org/cmd/go/#hdr-Relative_import_paths" rel="nofollow">https://golang.org/cmd/go/#hdr-Relative_import_paths</a></p>
<p>So seems like golang can use relative paths</p></pre>TheMerovius: <pre><p>It shouldn't, though.</p>
<p>The solution is that what you are doing is either a) a fork in the gh-sense, the same project, just created to experiment or create a PR. In that case, add your fork as a new remote to the repo and don't touch the import paths. Or b) a fork in the open source software sense, a new project, with changes, meant for actual usage and long-term maintained. In that case, changing the import paths is the correct thing to do.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传