build: Exclude .pb.go files from goimports checking

protoc-gen-go generates non-style-compliant import directives, but since
those files are just generated anyway we don't need to worry too much
about what style they are in: the style that protoc-gen-go generates is
the canonical style for these ones.
This commit is contained in:
Martin Atkins 2022-08-26 10:46:38 -07:00
parent 443d470a86
commit 746bd49723

View File

@ -29,7 +29,11 @@ fi
# "IFS" environment variable, but the primary place we want to run this right
# now is in our "quick checks" workflow and that _does_ have a reasonably
# modern version of Bash.
readarray -t target_files < <(git diff --name-only ${base_branch} --diff-filter=MA | grep "\.go")
readarray -t target_files < <(git diff --name-only ${base_branch} --diff-filter=MA | grep "\.go" | grep -v ".pb.go")
# NOTE: The above intentionally excludes .pb.go files because those are
# generated by a tool (protoc-gen-go) which itself doesn't produce
# style-compliant imports.
if [[ "${#target_files[@]}" -eq 0 ]]; then
echo "No files have changed relative to branch ${base_branch}, so there's nothing to check!"