代码拉取完成,页面将自动刷新
#!/bin/bash
# Using clang-format and gofmt to format c/c++/golang source code.
formatByClangFormat() {
for file in $(find $1 -regextype "posix-egrep" -regex ".*[A-Za-z_]\.(h|c|cc)")
do
COMMAND="clang-format -i $file"
eval $COMMAND
done
echo "clang-format for directory: $1"
}
if command -v clang-format >/dev/null; then
DIRS=( ./cxx/src ./cxx/examples )
for DIR in "${DIRS[@]}"
do
formatByClangFormat $DIR
done
else
echo "[ERROR] clang-format is required to format c/c++ code"
fi
formatByGoFmt() {
for file in $(find $1 -name "*.go")
do
COMMAND="gofmt -w $file"
echo $COMMAND
eval $COMMAND
done
}
if command -v gofmt >/dev/null; then
formatByGoFmt ./golang/examples
else
echo "[WARN] gofmt is required to format golang code"
fi
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。