diff options
author | Jacob Vosmaer <jacob@gitlab.com> | 2019-06-07 21:03:08 +0300 |
---|---|---|
committer | John Cai <jcai@gitlab.com> | 2019-06-07 21:03:08 +0300 |
commit | b70f07697cefe58fd167702f380fa271d5ea8358 (patch) | |
tree | 961a6d15cc200a38417b21b78dc9bb36e47462fd | |
parent | a09282f70e94d5ed18f0d02be7c5ac248894a17e (diff) |
Check for dirty go.mod/go.sum in CI
-rwxr-xr-x | _support/check-mod-tidy | 19 | ||||
-rw-r--r-- | _support/makegen.go | 7 |
2 files changed, 25 insertions, 1 deletions
diff --git a/_support/check-mod-tidy b/_support/check-mod-tidy new file mode 100755 index 000000000..2bce95221 --- /dev/null +++ b/_support/check-mod-tidy @@ -0,0 +1,19 @@ +#!/usr/bin/env ruby + +require_relative 'run.rb' + +def main + mod_not_changed! + run!(%w[go mod tidy]) + mod_not_changed! +end + +def mod_not_changed! + %w[go.mod go.sum].each do |f| + unless system(*%W[git diff --quiet --exit-code #{f}]) + abort "error: uncommitted changes in #{f}" + end + end +end + +main diff --git a/_support/makegen.go b/_support/makegen.go index 19742516e..c74aa5f99 100644 --- a/_support/makegen.go +++ b/_support/makegen.go @@ -419,7 +419,12 @@ rspec-gitlab-shell: {{ .GitlabShellDir }}/config.yml assemble-go prepare-tests cp $< $@ .PHONY: verify -verify: lint check-formatting staticcheck notice-up-to-date govendor-tagged rubocop +verify: check-mod-tidy lint check-formatting staticcheck notice-up-to-date govendor-tagged rubocop + +.PHONY: check-mod-tidy +check-mod-tidy: + # check-mod-tidy + @cd {{ .SourceDir }} && _support/check-mod-tidy .PHONY: lint lint: {{ .GoLint }} |