Skip to content

Commit

Permalink
fix: Use go mod download (#1345)
Browse files Browse the repository at this point in the history
Recommend using `go mod download` rather than `go mod tidy` for fetching
dependencies. The `tidy` function is used to update things and chagnes
the dependency graph. Using the `download` function avoids any changes.

Signed-off-by: Ben Kochie <superq@gmail.com>
  • Loading branch information
SuperQ committed Feb 17, 2020
1 parent a099acf commit 7625a70
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .goreleaser.yml
Expand Up @@ -3,7 +3,7 @@ env:
- GOPROXY=https://gocenter.io
before:
hooks:
- go mod tidy
- go mod download
builds:
- env:
- CGO_ENABLED=0
Expand Down
4 changes: 2 additions & 2 deletions internal/static/config.go
Expand Up @@ -6,8 +6,8 @@ const ExampleConfig = `# This is an example goreleaser.yaml file with some sane
# Make sure to check the documentation at http://goreleaser.com
before:
hooks:
# you may remove this if you don't use vgo
- go mod tidy
# You may remove this if you don't use go modules.
- go mod download
# you may remove this if you don't need go generate
- go generate ./...
builds:
Expand Down
4 changes: 2 additions & 2 deletions www/content/build.md
Expand Up @@ -138,13 +138,13 @@ GOVERSION=$(go version) goreleaser
try to download the dependencies. Since several builds run in parallel, it is
very likely to fail.

You can solve this by running `go mod tidy` before calling `goreleaser` or
You can solve this by running `go mod download` before calling `goreleaser` or
by adding a [hook][] doing that on your `.goreleaser.yaml` file:

```yaml
before:
hooks:
- go mod tidy
- go mod download
# rest of the file...
```

Expand Down
4 changes: 2 additions & 2 deletions www/content/env.md
Expand Up @@ -16,11 +16,11 @@ env:
- GO111MODULE=on
before:
hooks:
- go mod tidy
- go mod download
builds:
- binary: program
```

This way, both `go mod tidy` and the underlying `go build` will have
This way, both `go mod download` and the underlying `go build` will have
`GO111MODULE` set to `on`.

2 changes: 1 addition & 1 deletion www/content/hooks.md
Expand Up @@ -18,7 +18,7 @@ before:
hooks:
- make clean
- go generate ./...
- go mod tidy
- go mod download
- touch {{ .Env.FILE_TO_TOUCH }}
```

Expand Down

0 comments on commit 7625a70

Please sign in to comment.