使用专用git存储库时,您的工作空间的结构 [英] Structure for your go workspace when using private git repository
问题描述
我可以看看<$ c是什么, $ c> go获取在获取github项目时起作用,但假设我自己的git项目没有 当你使用你自己的git私有仓库时,你应该使用什么布局和 这个包本身并没有引用它的存储位置。您只有: 因此,您可以在您自己的结构中使用本地版本,正如Volker在其评论中指出的那样。这是您在自己的项目中使用的导入路径: 然后你可以打开它的源代码并将 除非您想要导入 Ive been trying to work out what the standard folder layout/structure for go code/workspaces when you are not using github. I can see how What layout and The package in itself carries no reference to where it is stored. You only have: So, you can have your local version in your own structure, as Volker pointed out in his comment. This is the import path you use in your own projects: Then you can open source it and put This works perfectly fine unless you want to open-source packages which imports 这篇关于使用专用git存储库时,您的工作空间的结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! {github.com} / {username} / {projectname} $
> > p>
git get
url?
包mypackage
importmy / custom / path / mypackage
mypackage
放到GitHub上。这将允许其他人通过 go get
命令获得它,但它们将使用 github.com
import :
importgithub.com/myuser/mypackage
my / custom / path / mypackage
即可。在这种情况下,您应该考虑重构您的路径,以便您使用与包的用户相同的github导入路径。go get
works when fetching github projects, but assumedly my own git projects would not have the {github.com}/{username}/{projectname}
structure that is referenced by go get
and how is structed on disk after you do go get
git get
url should you have when using your own git private repositories?package mypackage
import "my/custom/path/mypackage"
mypackage
onto GitHub. This will allow everyone else to get it with the go get
command, but they will be using the github.com
import:import "github.com/myuser/mypackage"
my/custom/path/mypackage
. In such a case, you should consider restructuring your paths so that you use the same github import paths as the users of your package does.