Skip to content

Commit

Permalink
Ignore cobra auto-generate comments in doc diff (ko-build#420)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
halvards authored Aug 19, 2021
1 parent 780c281 commit 040b7c7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions hack/presubmit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/

0 comments on commit 040b7c7

Please sign in to comment.