fix: rustcheck not work in CI (#43302)

relate: https://github.com/milvus-io/milvus/issues/42806

Signed-off-by: aoiasd <zhicheng.yue@zilliz.com>
This commit is contained in:
aoiasd 2025-07-16 14:32:50 +08:00 committed by GitHub
parent b69e601fe1
commit 097f4ce17a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 3 deletions

View File

@ -145,10 +145,13 @@ cppcheck:
@#(env bash ${PWD}/scripts/core_build.sh -l)
@(env bash ${PWD}/scripts/check_cpp_fmt.sh)
rustcheck:
rustfmt:
@echo "Running cargo format"
@env bash ${PWD}/scripts/run_cargo_format.sh ${PWD}/internal/core/thirdparty/tantivy/tantivy-binding/
rustcheck:
@echo "Running cargo check"
@env bash ${PWD}/scripts/run_cargo_format.sh ${PWD}/internal/core/thirdparty/tantivy/tantivy-binding/ --check
fmt:
ifdef GO_DIFF_FILES

View File

@ -1,6 +1,17 @@
#!/bin/bash
(
cd $1
cargo fmt
cd "$1" || exit 1
if [ "$2" == "--check" ]; then
if ! cargo fmt --all -- --check; then
echo "Rust code is not properly formatted."
exit 1
fi
echo "Check rust format success"
else
cargo fmt --all
fi
exit 0
)