Skip to content

Commit

Permalink
Specify docker container version
Browse files Browse the repository at this point in the history
  • Loading branch information
lockshaw committed Aug 8, 2023
1 parent 0113ebd commit 977dd3e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ format_diff() {
local filepath="$1"
# Invoke clang-format with dry run and formatting error output
if [[ $CLANG_FORMAT_MAJOR_VERSION -gt "9" ]]; then
local_format="$(docker run -i -v "$(pwd)":"$(pwd)" -w "$(pwd)" --rm ghcr.io/lockshaw/clang-format -n --Werror --style=file:"./.clang-format-for-format-sh" "${filepath}")"
local_format="$(docker run -i -v "$(pwd)":"$(pwd)" -w "$(pwd)" --rm ghcr.io/lockshaw/clang-format:${CLANG_FORMAT_MAJOR_VERSION} -n --Werror --style=file:"./.clang-format-for-format-sh" "${filepath}")"
else # Versions below 9 don't have dry run
formatted="$(docker run -i -v "$(pwd)":"$(pwd)" -w "$(pwd)" --rm ghcr.io/lockshaw/clang-format --style=file --fallback-style="$FALLBACK_STYLE" "${filepath}")"
formatted="$(docker run -i -v "$(pwd)":"$(pwd)" -w "$(pwd)" --rm ghcr.io/lockshaw/clang-format:${CLANG_FORMAT_MAJOR_VERSION} --style=file --fallback-style="$FALLBACK_STYLE" "${filepath}")"
local_format="$(diff -q <(cat "${filepath}") <(echo "${formatted}"))"
fi

Expand Down

0 comments on commit 977dd3e

Please sign in to comment.