在Go中,有一种做法是,如果您创建一个存储在GitHub上的项目,则使用以下文件夹名称:
./src/github.com/<user>/<repo>
Run Code Online (Sandbox Code Playgroud)
当我现在跑步时go get,Go知道如何检查回购.
现在我想知道Go for GitHub中是否有一些特殊的支持(如果是的话,还有其它可用的东西),或者这是否适用于任何URL(如果是这样的话,那么必须在该URL上放置什么事情有效).
有人可以对此有所了解吗?
是的,go工具支持最流行的代码托管网站开箱即用:
Bitbucket (Git, Mercurial)
import "bitbucket.org/user/project"
import "bitbucket.org/user/project/sub/directory"
GitHub (Git)
import "github.com/user/project"
import "github.com/user/project/sub/directory"
Google Code Project Hosting (Git, Mercurial, Subversion)
import "code.google.com/p/project"
import "code.google.com/p/project/sub/directory"
import "code.google.com/p/project.subrepository"
import "code.google.com/p/project.subrepository/sub/directory"
Launchpad (Bazaar)
import "launchpad.net/project"
import "launchpad.net/project/series"
import "launchpad.net/project/series/sub/directory"
import "launchpad.net/~user/project/branch"
import "launchpad.net/~user/project/branch/sub/directory"
Run Code Online (Sandbox Code Playgroud)
对于未知站点,您有两个选项 - 直接在导入路径中指定VCS类型:
import "example.org/user/foo.git"
Run Code Online (Sandbox Code Playgroud)
或者准备你的repo以在HTML中包含标记,如下所示:
<meta name="go-import" content="example.org git https://code.org/r/p/exproj">
Run Code Online (Sandbox Code Playgroud)
有关详细信息,请参阅go docs,它已经过全面解释(也可以通过go help importpath获得,如评论中所述):
http://golang.org/cmd/go/#hdr-Remote_import_paths
| 归档时间: |
|
| 查看次数: |
114 次 |
| 最近记录: |