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.

Usage

  • Go-get command
go get example.org/foo
  • Remote import paths
import "example.org/foo"

Packages

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:

  1. bob
  2. bob/my-project
  3. bob/my-project/some-other-project
  4. tom
  5. 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:

RequestProject
/bobbob
/bob/package1bob
/bob/my-projectbob/my-project
/bob/my-project/package1bob/my-project
/bob/my-project/package1/folder2bob/my-project

Access (Anonymous vs. Authenticated URLs)

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).