Merge pull request #14872 from HeavenTonight/fix-makefile

Make sure shellcheck exist
This commit is contained in:
Benjamin Wang 2022-12-06 05:58:24 +08:00 committed by GitHub
commit b851eac5b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -141,4 +141,5 @@ clean:
rm -rf ./release
rm -rf ./coverage/*.err ./coverage/*.out
rm -rf ./tests/e2e/default.proxy
rm -rf ./bin/shellcheck*
find ./ -name "127.0.0.1:*" -o -name "localhost:*" -o -name "*.log" -o -name "agent-*" -o -name "*.coverprofile" -o -name "testname-proxy-*" -delete

View File

@ -53,6 +53,7 @@ fi
PASSES=${PASSES:-"fmt bom dep build unit"}
PKG=${PKG:-}
SHELLCHECK_VERSION=${SHELLCHECK_VERSION:-"v0.8.0"}
if [ -z "$GOARCH" ]; then
GOARCH=$(go env GOARCH);
@ -388,9 +389,15 @@ function cov_pass {
######### Code formatting checkers #############################################
function shellcheck_pass {
if tool_exists "shellcheck" "https://github.com/koalaman/shellcheck#installing"; then
generic_checker run shellcheck -fgcc scripts/*.sh
SHELLCHECK=shellcheck
if ! tool_exists "shellcheck" "https://github.com/koalaman/shellcheck#installing"; then
log_callout "Installing shellcheck $SHELLCHECK_VERSION"
wget -qO- "https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" | tar -xJv -C /tmp/ --strip-components=1
mkdir -p ./bin
mv /tmp/shellcheck ./bin/
SHELLCHECK=./bin/shellcheck
fi
generic_checker run ${SHELLCHECK} -fgcc scripts/*.sh
}
function shellws_pass {