This plugin provides support of remote import paths and go-get command, which means that you can perform go get
(and thus dep
) requests against a Gerrit project.
go get example.org/foo
import "example.org/foo"
Go packages may be imported by specifying the package's folder after the repository name. For example, “import github.com/bob/my-project/package1” will download the repository from github.com/bob/my-project
and then include the package package1
.
For Gerrit, this is still possible, but it's a little bit more ambiguous. On GitHub, all projects have a depth of two: (1) group and (2) repository. On Gerrit, any project may have an arbitrary depth. Thus, the following project names are valid in Gerrit:
bob
bob/my-project
bob/my-project/some-other-project
tom
tom/my-project
When a user requests a package via go get
, this plugin will attempt to match the most specific project and return that.
Using our previous examples of existing projects, this plugin will return the following projects for the given requests:
Request | Project |
---|---|
/bob | bob |
/bob/package1 | bob |
/bob/my-project | bob/my-project |
/bob/my-project/package1 | bob/my-project |
/bob/my-project/package1/folder2 | bob/my-project |
The exact git clone URL served to the client go command will depend on the project's configured ACLs. If the project is configured to allow anonymous read access to refs/heads/*
, an anonymous URL will be served (e.g. https://gerrit.example/bob/my-project
). Otherwise, a URL that requires authentication will be used (e.g. https://gerrit.example/a/bob/my-project
).