Fix bug in fmt bash script
@@ -7,9 +7,10 @@ while IFS= read -r line; do dirs+=("$line"); done <<< "$(go list -f \{\{.Dir\}\}
# go list will list all subdirectories and goimports acts recursively. This
# results in certain files being reported multiple time. Therefore, we must
# dedup them. We also ignore protobuf auto-generated code.
-files=$(bin/goimports -l "${dirs[@]}" | sort -u | grep -v pb.go)
+files=()
+while IFS= read -r line; do files+=("$line"); done <<< "$(bin/goimports -l "${dirs[@]}" | sort -u | grep -v pb.go | grep -v gogen.go )"
-if [ -n "$files" ]; then
+if [[ ${files[*]} ]]; then
for file in "${files[@]}"; do
bin/goimports -d "$@" "$file"
done
