Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-07 12:09:13 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-07 12:09:13 +0300
commit41cb558299b483b44b45351730ee4c0e9fe4ca2c (patch)
tree00688a9e40021c66195ad826ceddd9c19385cdcf /doc/ci/caching/index.md
parent3d064c737e8448880e6180aeddc59000a01aa6a8 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/ci/caching/index.md')
-rw-r--r--doc/ci/caching/index.md24
1 files changed, 24 insertions, 0 deletions
diff --git a/doc/ci/caching/index.md b/doc/ci/caching/index.md
index c2d206dde54..12267b4ab9f 100644
--- a/doc/ci/caching/index.md
+++ b/doc/ci/caching/index.md
@@ -329,6 +329,30 @@ rspec:
- 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
Caching is an optimization, but isn't guaranteed to always work, so you need to