1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

validate: format vendor script with shfmt

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit b9fd2cf605)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-08-26 18:31:23 +02:00
parent f1bd611d41
commit 51bf7da729
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -1,20 +1,20 @@
#!/usr/bin/env bash
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SCRIPTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPTDIR}/.validate"
validate_vendor_diff(){
validate_vendor_diff() {
IFS=$'\n'
check_files=( 'vendor.sum' 'vendor.mod' 'vendor/' )
check_files=('vendor.sum' 'vendor.mod' 'vendor/')
# shellcheck disable=SC2207
changed_files=( $(validate_diff --diff-filter=ACMR --name-only -- "${check_files[@]}" || true) )
changed_files=($(validate_diff --diff-filter=ACMR --name-only -- "${check_files[@]}" || true))
unset IFS
if [ -n "${TEST_FORCE_VALIDATE:-}" ] || [ "${#changed_files[@]}" -gt 0 ]; then
# recreate vendor/
./hack/vendor.sh
# check if any files have changed
diffs="$(git status --porcelain -- "${check_files[@]}" 2>/dev/null)"
diffs="$(git status --porcelain -- "${check_files[@]}" 2> /dev/null)"
mfiles="$(echo "$diffs" | awk '/^ M / {print $2}')"
if [ "$diffs" ]; then
{
@ -24,7 +24,7 @@ validate_vendor_diff(){
echo
echo 'Please vendor your package with hack/vendor.sh.'
echo
if [ -n "$mfiles" ] ; then
if [ -n "$mfiles" ]; then
git diff -- "$mfiles"
fi
} >&2