Commit 6a68ec20 authored by Ethan Reesor's avatar Ethan Reesor

Go proxy documentation edits

parent 255321ed
...@@ -13,7 +13,7 @@ The Packages feature allows GitLab to act as a repository for the following: ...@@ -13,7 +13,7 @@ The Packages feature allows GitLab to act as a repository for the following:
| [Conan Repository](../../user/packages/conan_repository/index.md) | The GitLab Conan Repository enables every project in GitLab to have its own space to store [Conan](https://conan.io/) packages. | 12.4+ | | [Conan Repository](../../user/packages/conan_repository/index.md) | The GitLab Conan Repository enables every project in GitLab to have its own space to store [Conan](https://conan.io/) packages. | 12.4+ |
| [Maven Repository](../../user/packages/maven_repository/index.md) | The GitLab Maven Repository enables every project in GitLab to have its own space to store [Maven](https://maven.apache.org/) packages. | 11.3+ | | [Maven Repository](../../user/packages/maven_repository/index.md) | The GitLab Maven Repository enables every project in GitLab to have its own space to store [Maven](https://maven.apache.org/) packages. | 11.3+ |
| [NPM Registry](../../user/packages/npm_registry/index.md) | The GitLab NPM Registry enables every project in GitLab to have its own space to store [NPM](https://www.npmjs.com/) packages. | 11.7+ | | [NPM Registry](../../user/packages/npm_registry/index.md) | The GitLab NPM Registry enables every project in GitLab to have its own space to store [NPM](https://www.npmjs.com/) packages. | 11.7+ |
| [Go Proxy](../../user/packages/go_proxy/index.md) | The GitLab Go Proxy enables every project in GitLab to be fetched via the [Go proxy protocol](https://proxy.golang.org/). | 13.0+ | | [Go Proxy](../../user/packages/go_proxy/index.md) | The Go proxy for GitLab enables every project in GitLab to be fetched with the [Go proxy protocol](https://proxy.golang.org/). | 13.0+ |
Don't you see your package management system supported yet? Don't you see your package management system supported yet?
Please consider contributing Please consider contributing
......
# GitLab Go Proxy **(PREMIUM)** # GitLab Go Proxy **(PREMIUM)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/27376) in [GitLab Premium](https://about.gitlab.com/pricing/) 13.0. > [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/27376) in [GitLab
> Premium](https://about.gitlab.com/pricing/) 13.0.
The GitLab Go Proxy implements the Go proxy protocol. With the Go proxy for GitLab, every project in GitLab can be fetched with the
[Go proxy protocol](https://proxy.golang.org/).
NOTE: **Note:**
GitLab does not (yet) display Go modules in the **Packages** section of a
project. Only the Go proxy protocol is supported at this time, and only for
modules on GitLab.
## Enable the Go proxy ## Enable the Go proxy
...@@ -25,6 +22,11 @@ by default. To enable it for existing projects, or if you want to disable it: ...@@ -25,6 +22,11 @@ by default. To enable it for existing projects, or if you want to disable it:
You should then be able to see the **Packages** section on the left sidebar. You should then be able to see the **Packages** section on the left sidebar.
Next, you must configure your development environment to use the Go proxy. Next, you must configure your development environment to use the Go proxy.
NOTE: **Note:**
GitLab does not display Go modules in the **Packages** section of a project.
Only the Go proxy protocol is supported at this time, and only for modules on
GitLab.
## Add GitLab as a Go proxy ## Add GitLab as a Go proxy
NOTE: **Note:** NOTE: **Note:**
...@@ -35,10 +37,11 @@ The available proxy endpoints are: ...@@ -35,10 +37,11 @@ The available proxy endpoints are:
- Project - can fetch modules defined by a project - `/api/v4/projects/:id/packages/go` - Project - can fetch modules defined by a project - `/api/v4/projects/:id/packages/go`
Go's use of proxies is configured with the `GOPROXY` environment variable, as a Go's use of proxies is configured with the `GOPROXY` environment variable, as a
comma separated list of URLs. Go 1.14 adds support for managing Go's environment comma separated list of URLs. Go 1.14 adds support for comma separated list of
variables via `go env -w`, e.g. `go env -w GOPROXY=...`. This will write to URLs. Go 1.14 adds support for using `go env -w` to manage Go's environment
`$GOPATH/env` (which defaults to `~/.go/env`). `GOPROXY` can also be configured variables. For example, `go env -w GOPROXY=...` writes to to `$GOPATH/env`
as a normal environment variable, via RC files or `export GOPROXY=...`. (which defaults to `~/.go/env`). `GOPROXY` can also be configured as a normal
environment variable, with RC files or `export GOPROXY=...`.
The default value of `$GOPROXY` is `https://proxy.golang.org,direct`, which The default value of `$GOPROXY` is `https://proxy.golang.org,direct`, which
tells `go` to first query `proxy.golang.org` and fallback to direct VCS tells `go` to first query `proxy.golang.org` and fallback to direct VCS
...@@ -53,7 +56,8 @@ that. ...@@ -53,7 +56,8 @@ that.
For example, with the following configuration, Go will attempt to fetch modules For example, with the following configuration, Go will attempt to fetch modules
from 1) GitLab project 1234's Go module proxy, 2) `proxy.golang.org`, and from 1) GitLab project 1234's Go module proxy, 2) `proxy.golang.org`, and
finally 3) directly via VCS. finally 3) directly with Git (or another VCS, depending on where the module
source is hosted).
```shell ```shell
go env -w GOPROXY=https://gitlab.com/api/v4/projects/1234/packages/go,https://proxy.golang.org,direct go env -w GOPROXY=https://gitlab.com/api/v4/projects/1234/packages/go,https://proxy.golang.org,direct
...@@ -86,13 +90,8 @@ gitlab.com/my-group` will restrict the credentials to URLs starting with ...@@ -86,13 +90,8 @@ gitlab.com/my-group` will restrict the credentials to URLs starting with
## Release a module ## Release a module
NOTE: **Note:** Go modules and module versions are handled entirely with Git (or SVN, Mercurial,
For a complete understanding of Go modules and versioning, see [this series of and so on). A module is a repository containing Go source and a `go.mod` file. A
blog posts](https://blog.golang.org/using-go-modules) on the official Go
website.
Go modules and module versions are handled entirely via Git (or SVN, Mercurial,
etc). A module is a repository containing Go source and a `go.mod` file. A
version of a module is a Git tag (or equivalent) that is a valid [semantic version of a module is a Git tag (or equivalent) that is a valid [semantic
version](https://semver.org), prefixed with 'v'. For example, `v1.0.0` and version](https://semver.org), prefixed with 'v'. For example, `v1.0.0` and
`v1.3.2-alpha` are valid module versions, but `v1` or `v1.2` are not. `v1.3.2-alpha` are valid module versions, but `v1` or `v1.2` are not.
...@@ -101,6 +100,10 @@ Go requires that major versions after v1 involve a change in the import path of ...@@ -101,6 +100,10 @@ Go requires that major versions after v1 involve a change in the import path of
the module. For example, version 2 of the module `gitlab.com/my/project` must be the module. For example, version 2 of the module `gitlab.com/my/project` must be
imported and released as `gitlab.com/my/project/v2`. imported and released as `gitlab.com/my/project/v2`.
For a complete understanding of Go modules and versioning, see [this series of
blog posts](https://blog.golang.org/using-go-modules) on the official Go
website.
## Valid modules and versions ## Valid modules and versions
The GitLab Go proxy will ignore modules and module versions that have an invalid The GitLab Go proxy will ignore modules and module versions that have an invalid
...@@ -108,9 +111,9 @@ The GitLab Go proxy will ignore modules and module versions that have an invalid ...@@ -108,9 +111,9 @@ The GitLab Go proxy will ignore modules and module versions that have an invalid
`gitlab.com/my/project` can be accessed via that same URL, and that the first `gitlab.com/my/project` can be accessed via that same URL, and that the first
line of `go.mod` is `module gitlab.com/my/project`. If `go.mod` names a line of `go.mod` is `module gitlab.com/my/project`. If `go.mod` names a
different module, compilation will fail. Additionally, Go requires, for major different module, compilation will fail. Additionally, Go requires, for major
versions after 1, that the name of the module have an appropriate suffix, e.g. versions after 1, that the name of the module have an appropriate suffix, for
`gitlab.com/my/project/v2`. If the `module` directive does not also have this example `gitlab.com/my/project/v2`. If the `module` directive does not also have
suffix, compilation will fail. this suffix, compilation will fail.
Go supports 'pseudo-versions' that encode the timestamp and SHA of a commit. Go supports 'pseudo-versions' that encode the timestamp and SHA of a commit.
Tags that match the pseudo-version pattern are ignored, as otherwise they could Tags that match the pseudo-version pattern are ignored, as otherwise they could
......
...@@ -21,7 +21,7 @@ The Packages feature allows GitLab to act as a repository for the following: ...@@ -21,7 +21,7 @@ The Packages feature allows GitLab to act as a repository for the following:
| [NPM Registry](npm_registry/index.md) **(PREMIUM)** | The GitLab NPM Registry enables every project in GitLab to have its own space to store [NPM](https://www.npmjs.com/) packages. | 11.7+ | | [NPM Registry](npm_registry/index.md) **(PREMIUM)** | The GitLab NPM Registry enables every project in GitLab to have its own space to store [NPM](https://www.npmjs.com/) packages. | 11.7+ |
| [NuGet Repository](nuget_repository/index.md) **(PREMIUM)** | The GitLab NuGet Repository will enable every project in GitLab to have its own space to store [NuGet](https://www.nuget.org/) packages. | 12.8+ | | [NuGet Repository](nuget_repository/index.md) **(PREMIUM)** | The GitLab NuGet Repository will enable every project in GitLab to have its own space to store [NuGet](https://www.nuget.org/) packages. | 12.8+ |
| [PyPi Repository](pypi_repository/index.md) **(PREMIUM)** | The GitLab PyPi Repository will enable every project in GitLab to have its own space to store [PyPi](https://pypi.org/) packages. | 12.10+ | | [PyPi Repository](pypi_repository/index.md) **(PREMIUM)** | The GitLab PyPi Repository will enable every project in GitLab to have its own space to store [PyPi](https://pypi.org/) packages. | 12.10+ |
| [Go Proxy](go_proxy/index.md) **(PREMIUM)** | The GitLab Go Proxy enables every project in GitLab to be fetched via the [Go proxy protocol](https://proxy.golang.org/). | 13.0+ | | [Go Proxy](go_proxy/index.md) **(PREMIUM)** | The Go proxy for GitLab enables every project in GitLab to be fetched with the [Go proxy protocol](https://proxy.golang.org/). | 13.0+ |
## Enable the Package Registry for your project ## Enable the Package Registry for your project
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment