Skip to content

Commit

Permalink
[ci] Use gofmt to avoid go fmt downloading dependencies
Browse files Browse the repository at this point in the history
`go fmt` doesn't seem to respect `-mod=vendor`
golang/go#27841

Instead try using `gofmt` which doesn't trigger downloading dependencies
in the first place. However, `gofmt` affects files under `vendor/`, so
we reset that before checking for changes.
  • Loading branch information
mislav committed Oct 2, 2019
1 parent 9946497 commit 75c5410
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion script/test
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ trap "exit 1" INT

check_formatting() {
[[ "$(go version)" != *" go1.8."* ]] || return 0
make fmt >/dev/null
gofmt -l -w . >/dev/null
git checkout -- vendor
if ! git diff -U1 --exit-code; then
echo
echo "Some go code was not formatted properly." >&2
Expand Down

0 comments on commit 75c5410

Please sign in to comment.