From 535b33ec9cb69da995bb21057676a1f8b0f2e429 Mon Sep 17 00:00:00 2001 From: Armel Soro Date: Mon, 24 Oct 2022 13:05:54 +0200 Subject: [PATCH] Exclude the 'dist' folder from 'check-gofmt.sh' script The 'dist' folder is created when generating an RPM Package using the `rpm-prepare.sh` and `rpm-local-build.sh` scripts, and might contain Go files in `dist/rpmbuild/BUILD/**/vendor`. --- scripts/check-gofmt.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/check-gofmt.sh b/scripts/check-gofmt.sh index 2c3cccef305..b8d23bcc687 100755 --- a/scripts/check-gofmt.sh +++ b/scripts/check-gofmt.sh @@ -1,10 +1,10 @@ #!/bin/bash # Why we are wrapping gofmt? -# - ignore files in vendor directory +# - ignore files in certain directories, like 'vendor' or 'dist' (created when building RPM Packages of odo) # - gofmt doesn't exit with error code when there are errors -GO_FILES=$(find . -path ./vendor -prune -o -name '*.go' -print) +GO_FILES=$(find . \( -path ./vendor -o -path ./dist \) -prune -o -name '*.go' -print) for file in $GO_FILES; do gofmtOutput=$(gofmt -l "$file") @@ -17,7 +17,7 @@ done if [ ${#errors[@]} -eq 0 ]; then echo "gofmt OK" else - echo "gofmt ERROR - These files are not formated by gofmt:" + echo "gofmt ERROR - These files are not formatted by gofmt:" for err in "${errors[@]}"; do echo "$err" done