diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2020-08-20 08:38:58 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2020-08-20 14:20:19 +0300 |
commit | 1184a055dea81ff9f2f72216823a87b8a003ae94 (patch) | |
tree | f9013f181b5b8516b1e49836371d03e5f9fdd0f2 | |
parent | 489e4eace7fb09c42771e94e7fb2eee52f5de6c2 (diff) |
Makefile: Inline check-mod-tidy
With PATH now containing a broken version of Git by design, we need to
adjust all callers of Git to use the real executable instead of the
broken one. The script `check-mod-tidy` is one of those which needs
adjusting.
Given it's such a tiny script, let's just inline it into our Makefile
and have it use the `${GIT}` variable.
-rw-r--r-- | Makefile | 4 | ||||
-rwxr-xr-x | _support/check-mod-tidy | 19 |
2 files changed, 3 insertions, 20 deletions
@@ -205,7 +205,9 @@ verify: check-mod-tidy check-formatting notice-up-to-date check-proto rubocop .PHONY: check-mod-tidy check-mod-tidy: - ${Q}${SOURCE_DIR}/_support/check-mod-tidy + ${Q}${GIT} diff --quiet --exit-code go.mod go.sum || (echo "error: uncommitted changes in go.mod or go.sum" && exit 1) + ${Q}go mod tidy + ${Q}${GIT} diff --quiet --exit-code go.mod go.sum || (echo "error: uncommitted changes in go.mod or go.sum" && exit 1) .PHONY: lint lint: ${GOLANGCI_LINT} diff --git a/_support/check-mod-tidy b/_support/check-mod-tidy deleted file mode 100755 index 2bce95221..000000000 --- a/_support/check-mod-tidy +++ /dev/null @@ -1,19 +0,0 @@ -#!/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 |