The bash array usage was wrong - change to a simpler check that just
compares if the diff is empty.
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
| ... | ... |
@@ -4,17 +4,15 @@ set -e |
| 4 | 4 |
SCRIPTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
| 5 | 5 |
source "${SCRIPTDIR}/.validate"
|
| 6 | 6 |
|
| 7 |
-IFS=$'\n' |
|
| 8 | 7 |
api_files=$(validate_diff --diff-filter=ACMR --name-only -- 'api/' || true) |
| 9 | 8 |
client_files=$(validate_diff --diff-filter=ACMR --name-only -- 'client/' || true) |
| 10 |
-unset IFS |
|
| 11 | 9 |
|
| 12 | 10 |
has_errors=0 |
| 13 | 11 |
|
| 14 | 12 |
cat go.mod |
| 15 | 13 |
|
| 16 | 14 |
# Check if changes to ./api require a replace rule in go.mod |
| 17 |
-if [ -n "${TEST_FORCE_VALIDATE:-}" ] || [ ${#api_files[@]} -gt 0 ]; then
|
|
| 15 |
+if [ -n "${TEST_FORCE_VALIDATE:-}" ] || [ -n "${api_files}" ]; then
|
|
| 18 | 16 |
echo "Detected changes in ./api directory, checking for replace rule..." |
| 19 | 17 |
if ! go list -mod=readonly -m -json github.com/moby/moby/api | jq -e '.Replace'; then |
| 20 | 18 |
echo >&2 "ERROR: Changes detected in ./api but go.mod is missing a replace rule for github.com/moby/moby/api" |
| ... | ... |
@@ -26,7 +24,7 @@ if [ -n "${TEST_FORCE_VALIDATE:-}" ] || [ ${#api_files[@]} -gt 0 ]; then
|
| 26 | 26 |
fi |
| 27 | 27 |
|
| 28 | 28 |
# Check if changes to ./client require a replace rule in go.mod |
| 29 |
-if [ -n "${TEST_FORCE_VALIDATE:-}" ] || [ ${#client_files[@]} -gt 0 ]; then
|
|
| 29 |
+if [ -n "${TEST_FORCE_VALIDATE:-}" ] || [ -n "${client_files}" ]; then
|
|
| 30 | 30 |
echo "Detected changes in ./client directory, checking for replace rule..." |
| 31 | 31 |
if ! go list -mod=readonly -m -json github.com/moby/moby/client | jq -e '.Replace'; then |
| 32 | 32 |
echo >&2 "ERROR: Changes detected in ./client but go.mod is missing a replace rule for github.com/moby/moby/client" |