Commit 4dc3a316 authored by Marcel Amirault's avatar Marcel Amirault

Merge branch 'patch-91' into 'master'

DOCS - added go module cache support

See merge request gitlab-org/gitlab!27192
parents 75a4284b 387ab745
...@@ -329,6 +329,30 @@ rspec: ...@@ -329,6 +329,30 @@ rspec:
- rspec spec - rspec spec
``` ```
### Caching Go dependencies
Assuming your project is using [Go Modules](https://github.com/golang/go/wiki/Modules) to install
Go dependencies, the following example defines `cache` in a `go-cache` template, that
any job can extend. Go modules are installed in `${GOPATH}/pkg/mod/` and
are cached for all of the `go` projects:
```yaml
.go-cache:
variables:
GOPATH: $CI_PROJECT_DIR/.go
before_script:
- mkdir -p .go
cache:
paths:
- .go/pkg/mod/
test:
image: golang:1.13
extends: .go-cache
script:
- go test ./... -v -short
```
## Availability of the cache ## Availability of the cache
Caching is an optimization, but isn't guaranteed to always work, so you need to Caching is an optimization, but isn't guaranteed to always work, so you need to
......
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