summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile6
-rwxr-xr-xhack/verify-gofmt.sh39
2 files changed, 2 insertions, 43 deletions
diff --git a/Makefile b/Makefile
index 870ab9851..9a72c6603 100644
--- a/Makefile
+++ b/Makefile
@@ -83,10 +83,8 @@ lint: .gopathok varlink_generate
@./.tool/lint
gofmt:
- @./hack/verify-gofmt.sh
-
-fix_gofmt:
- @./hack/verify-gofmt.sh -f
+ find . -name '*.go' ! -path './vendor/*' -exec gofmt -s -w {} \+
+ git diff --exit-code
test/bin2img/bin2img: .gopathok $(wildcard test/bin2img/*.go)
$(GO) build -ldflags '$(LDFLAGS)' -tags "$(BUILDTAGS) containers_image_ostree_stub" -o $@ $(PROJECT)/test/bin2img
diff --git a/hack/verify-gofmt.sh b/hack/verify-gofmt.sh
deleted file mode 100755
index af252a13b..000000000
--- a/hack/verify-gofmt.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/bash
-
-set -o errexit
-set -o nounset
-set -o pipefail
-
-find_files() {
- find . -not \( \
- \( \
- -wholename '*/vendor/*' \
- \) -prune \
- \) -name '*.go' \
- -not \( -wholename './_output/*' \) \
- -not \( -wholename './cmd/podman/ioprojectatomicpodman/ioprojectatomicpodman.go' \)
-}
-FIX=0
-GOFMT="gofmt -s"
-bad_files=$(find_files | xargs $GOFMT -l)
-
-while getopts "f?:" opt; do
- case "$opt" in
- f) FIX=1
- ;;
- esac
-done
-
-if [[ -n "${bad_files}" ]]; then
- if (($FIX == 1)) ; then
- echo "Correcting the following files:"
- echo "${bad_files}"
- while read -r go_file; do
- gofmt -s -w $go_file
- done <<< "${bad_files}"
- else
- echo "!!! '$GOFMT' needs to be run on the following files: "
- echo "${bad_files}"
- exit 1
- fi
-fi