mirror of https://github.com/linkerd/linkerd2.git
20 lines
592 B
Bash
Executable File
20 lines
592 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -eu
|
|
|
|
# go list will exclude the vendor directory. We use grep to exclude generated
|
|
# code.
|
|
while IFS= read -r line; do dirs+=("$line"); done <<< "$(go list -f \{\{.Dir\}\} ./... | grep -v controller/gen | grep -v viz/metrics-api/gen )"
|
|
|
|
# go list will list all subdirectories and goimports acts recursively. This
|
|
# results in certain files being reported multiple time. Therefore, we must
|
|
# dedup them.
|
|
files=$(bin/goimports -l "${dirs[@]}" | sort -u)
|
|
|
|
if [ -n "$files" ]; then
|
|
for file in "${files[@]}"; do
|
|
bin/goimports -d "$@" "$file"
|
|
done
|
|
exit 64
|
|
fi
|