From 040b7c76982219dc05c7bb446ac0e22eb5f94d34 Mon Sep 17 00:00:00 2001 From: Halvard Skogsrud Date: Fri, 20 Aug 2021 01:47:47 +1000 Subject: [PATCH] Ignore cobra auto-generate comments in doc diff (#420) spf13/cobra inserts comments with dates in generated Markdown files. This change makes the presubmit check ignore those comments when verifying that ko's Markdown docs are up-to-date. Also fixes some `shellcheck` warnings. --- hack/presubmit.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hack/presubmit.sh b/hack/presubmit.sh index ae84f9663a..43102ba4b9 100755 --- a/hack/presubmit.sh +++ b/hack/presubmit.sh @@ -20,12 +20,13 @@ set -o pipefail PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" -pushd ${PROJECT_ROOT} +pushd "${PROJECT_ROOT}" trap popd EXIT # Verify that all source files are correctly formatted. find . -name "*.go" | grep -v vendor/ | xargs gofmt -d -e -l # Verify that generated Markdown docs are up-to-date. -mkdir -p /tmp/gendoc && go run cmd/help/main.go --dir /tmp/gendoc -diff -Naur /tmp/gendoc/ doc/ +tmpdir=$(mktemp -d) +go run cmd/help/main.go --dir "$tmpdir" +diff -Naur -I '###### Auto generated' "$tmpdir" doc/