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:
parent
f1bd611d41
commit
51bf7da729
1 changed files with 10 additions and 10 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue