Commit 80613d98 authored by Ethan Reesor's avatar Ethan Reesor

Detail how to configure Go to skip checksum downloads

parent 00da5590
......@@ -29,24 +29,38 @@ NOTE: **Note:**
`go` does not support transmitting credentials over insecure connections. The
steps below will only work if GitLab is configured for HTTPS.
GitLab's Go proxy implementation supports HTTP Basic authentication for personal
access tokens, in addition to the usual authentication mechanisms. To configure
Go to use HTTP Basic authentication, you must create a [personal access
token](../../profile/ with the `api` or `read_api`
scope and add it to [`~/.netrc`](
1. Configure Go to include HTTP basic authentication credentials when fetching from the Go proxy for GitLab.
2. Configure Go to *not* attempt to download checksums for private GitLab projects from the public checksum database.
#### Enable Request Authentication
Create a [personal access token](../../profile/ with
the `api` or `read_api` scope and add it to
machine my-server
login my-user
password my-token
machine <url> login <username> password <token>
Replace `my-user` with your username and `my-token` with your personal access
token. The value of `my-server` should be `` or the URL of your GitLab
instance. You can optionally append a path to `my-server`, which will restrict
the scope that the credentials will be used for. For example, `machine` will restrict the credentials to URLs starting with
`<url>` should be the URL of the GitLab instance, for example ``.
`<username>` and `<token>` should be your username and the personal access
token, respectively.
#### Disable Checksum Database
By default, Go will query `` for module checksums. This will not
work modules that are not public. `GONOSUMDB` can be used to disable downloading
checksums for specific URLs. This can be permanently set with `go env -w
- `` will disable checksum downloads for
- `` will disable checksum downloads for all
projects under ``
- `` will disable checksum downloads for *all* modules on
- `GOSUMDB=off` or `GONOSUMDB=*` will *completely* disable the checksum database
for all modules and packages.
## Add GitLab as a Go proxy
......@@ -104,7 +118,7 @@ website.
The GitLab Go proxy will ignore modules and module versions that have an invalid
`module` directive in their `go.mod`. Go requires that a package imported as
`` can be accessed via that same URL, and that the first
`` can be accessed with that same URL, and that the first
line of `go.mod` is `module`. If `go.mod` names a
different module, compilation will fail. Additionally, Go requires, for major
versions after 1, that the name of the module have an appropriate suffix, for
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment