mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Fix shellcheck warnings: Escaping.
```
build:3:65: note: Backslash is literal in "\n". Prefer explicit escaping: "\\n". [SC1117]
test:3:64: note: Backslash is literal in "\n". Prefer explicit escaping: "\\n". [SC1117]
scripts/fix.sh:23:17: note: Backslash is literal in "\n". Prefer explicit escaping: "\\n". [SC1117]
scripts/fix.sh:23:46: note: Backslash is literal in "\n". Prefer explicit escaping: "\\n". [SC1117]
scripts/fix.sh:30:17: note: Backslash is literal in "\n". Prefer explicit escaping: "\\n". [SC1117]
scripts/genproto.sh:38:17: note: Backslash is literal in "\n". Prefer explicit escaping: "\\n". [SC1117]
scripts/genproto.sh:53:17: note: Backslash is literal in "\n". Prefer explicit escaping: "\\n". [SC1117]
scripts/genproto.sh:73:23: note: Backslash is literal in "\(". Prefer explicit escaping: "\\(". [SC1117]
scripts/genproto.sh:73:33: note: Backslash is literal in "\(". Prefer explicit escaping: "\\(". [SC1117]
scripts/genproto.sh:74:69: note: Backslash is literal in "\1". Prefer explicit escaping: "\\1". [SC1117]
scripts/genproto.sh:74:78: note: Backslash is literal in "\2". Prefer explicit escaping: "\\2". [SC1117]
scripts/genproto.sh:75:40: note: Backslash is literal in "\(". Prefer explicit escaping: "\\(". [SC1117]
scripts/genproto.sh:75:52: note: Backslash is literal in "\1". Prefer explicit escaping: "\\1". [SC1117]
scripts/genproto.sh:91:17: note: Backslash is literal in "\n". Prefer explicit escaping: "\\n". [SC1117]
scripts/genproto.sh:115:17: note: Backslash is literal in "\n". Prefer explicit escaping: "\\n". [SC1117]
./test.sh:71:29: warning: Quote to prevent word splitting, or split robustly with mapfile or read -a. [SC2206]
./test.sh:400:28: note: Backslash is literal in "\t". Prefer explicit escaping: "\\t". [SC1117]
./test.sh:406:33: note: Backslash is literal in "\t". Prefer explicit escaping: "\\t". [SC1117]
./test.sh:415:36: note: Backslash is literal in "\*". Prefer explicit escaping: "\\*". [SC1117]
./test.sh:415:176: note: Backslash is literal in "\'". Prefer explicit escaping: "\\'". [SC1117]
./test.sh:493:56: note: Backslash is literal in "\.". Prefer explicit escaping: "\\.". [SC1117]
./test.sh:601:57: note: Backslash is literal in "\(". Prefer explicit escaping: "\\(". [SC1117]
./test.sh:601:64: note: Backslash is literal in "\)". Prefer explicit escaping: "\\)". [SC1117]
./test.sh:601:67: note: Backslash is literal in "\(". Prefer explicit escaping: "\\(". [SC1117]
./test.sh:601:74: note: Backslash is literal in "\)". Prefer explicit escaping: "\\)". [SC1117]
./test.sh:601:77: note: Backslash is literal in "\(". Prefer explicit escaping: "\\(". [SC1117]
./test.sh:601:84: note: Backslash is literal in "\)". Prefer explicit escaping: "\\)". [SC1117]
./test.sh:601:91: note: Backslash is literal in "\1". Prefer explicit escaping: "\\1". [SC1117]
./test.sh:601:94: note: Backslash is literal in "\2". Prefer explicit escaping: "\\2". [SC1117]
./test.sh:601:103: note: Backslash is literal in "\3". Prefer explicit escaping: "\\3". [SC1117]
```
This commit is contained in:
@@ -20,11 +20,11 @@ function bash_ws_fix {
|
||||
find ./ -name '*.sh.bak' -print0 | xargs -0 rm
|
||||
}
|
||||
|
||||
log_callout -e "\nFixing etcd code for you...\n"
|
||||
log_callout -e "\\nFixing etcd code for you...\\n"
|
||||
|
||||
run_for_modules run go fmt || exit 2
|
||||
run_for_modules mod_tidy_fix || exit 2
|
||||
run_for_module tests bom_fix || exit 2
|
||||
bash_ws_fix || exit 2
|
||||
|
||||
log_success -e "\nSUCCESS: etcd code is fixed :)"
|
||||
log_success -e "\\nSUCCESS: etcd code is fixed :)"
|
||||
|
||||
@@ -35,7 +35,7 @@ GOGOPROTO_PATH="${GOGOPROTO_ROOT}:${GOGOPROTO_ROOT}/protobuf"
|
||||
# directories containing protos to be built
|
||||
DIRS="./server/wal/walpb ./api/etcdserverpb ./server/etcdserver/api/snap/snappb ./raft/raftpb ./api/mvccpb ./server/lease/leasepb ./api/authpb ./server/etcdserver/api/v3lock/v3lockpb ./server/etcdserver/api/v3election/v3electionpb ./api/membershippb"
|
||||
|
||||
log_callout -e "\nRunning gofast (gogo) proto generation..."
|
||||
log_callout -e "\\nRunning gofast (gogo) proto generation..."
|
||||
|
||||
for dir in ${DIRS}; do
|
||||
run pushd "${dir}"
|
||||
@@ -50,7 +50,7 @@ for dir in ${DIRS}; do
|
||||
run popd
|
||||
done
|
||||
|
||||
log_callout -e "\nRunning swagger & grpc_gateway proto generation..."
|
||||
log_callout -e "\\nRunning swagger & grpc_gateway proto generation..."
|
||||
|
||||
# remove old swagger files so it's obvious whether the files fail to generate
|
||||
rm -rf Documentation/dev-guide/apispec/swagger/*json
|
||||
@@ -70,9 +70,9 @@ for pb in api/etcdserverpb/rpc server/etcdserver/api/v3lock/v3lockpb/v3lock serv
|
||||
gwfile="${pb}.pb.gw.go"
|
||||
|
||||
sed -i -E "s#package $pkg#package gw#g" "${gwfile}"
|
||||
sed -i -E "s#import \(#import \(\"go.etcd.io/etcd/${pkgpath}\"#g" "${gwfile}"
|
||||
sed -i -E "s#([ (])([a-zA-Z0-9_]*(Client|Server|Request)([^(]|$))#\1${pkg}.\2#g" "${gwfile}"
|
||||
sed -i -E "s# (New[a-zA-Z0-9_]*Client\()# ${pkg}.\1#g" "${gwfile}"
|
||||
sed -i -E "s#import \\(#import \\(\"go.etcd.io/etcd/${pkgpath}\"#g" "${gwfile}"
|
||||
sed -i -E "s#([ (])([a-zA-Z0-9_]*(Client|Server|Request)([^(]|$))#\\1${pkg}.\\2#g" "${gwfile}"
|
||||
sed -i -E "s# (New[a-zA-Z0-9_]*Client\\()# ${pkg}.\\1#g" "${gwfile}"
|
||||
sed -i -E "s|go.etcd.io/etcd|go.etcd.io/etcd/v3|g" "${gwfile}"
|
||||
sed -i -E "s|go.etcd.io/etcd/v3/api|go.etcd.io/etcd/api/v3|g" "${gwfile}"
|
||||
sed -i -E "s|go.etcd.io/etcd/v3/server|go.etcd.io/etcd/server/v3|g" "${gwfile}"
|
||||
@@ -88,7 +88,7 @@ for pb in api/etcdserverpb/rpc server/etcdserver/api/v3lock/v3lockpb/v3lock serv
|
||||
Documentation/dev-guide/apispec/swagger/"${swaggerName}".swagger.json
|
||||
done
|
||||
|
||||
log_callout -e "\nRunning swagger ..."
|
||||
log_callout -e "\\nRunning swagger ..."
|
||||
run_go_tool github.com/hexfusion/schwag -input=Documentation/dev-guide/apispec/swagger/rpc.swagger.json
|
||||
|
||||
if [ "$1" != "--skip-protodoc" ]; then
|
||||
@@ -112,4 +112,4 @@ else
|
||||
log_warning "skipping grpc API reference document auto-generation..."
|
||||
fi
|
||||
|
||||
log_success -e "\n./genproto SUCCESS"
|
||||
log_success -e "\\n./genproto SUCCESS"
|
||||
|
||||
@@ -146,7 +146,7 @@ function run {
|
||||
"${@}" 2> >(while read -r line; do echo -e "${COLOR_NONE}stderr: ${COLOR_MAGENTA}${line}${COLOR_NONE}">&2; done)
|
||||
local error_code=$?
|
||||
if [ ${error_code} -ne 0 ]; then
|
||||
log_error -e "FAIL: (code:${error_code}):\n % ${repro}"
|
||||
log_error -e "FAIL: (code:${error_code}):\\n % ${repro}"
|
||||
return ${error_code}
|
||||
fi
|
||||
}
|
||||
@@ -170,7 +170,7 @@ function module_dirs() {
|
||||
# maybe_run [cmd...] runs given command depending on the DRY_RUN flag.
|
||||
function maybe_run() {
|
||||
if ${DRY_RUN}; then
|
||||
log_warning -e "# DRY_RUN:\n % ${*}"
|
||||
log_warning -e "# DRY_RUN:\\n % ${*}"
|
||||
else
|
||||
run "${@}"
|
||||
fi
|
||||
@@ -280,7 +280,7 @@ function go_test {
|
||||
done
|
||||
|
||||
if [ -n "${failures[*]}" ] ; then
|
||||
log_error -e "ERROR: Tests for following packages failed:\n ${failures[*]}"
|
||||
log_error -e "ERROR: Tests for following packages failed:\\n ${failures[*]}"
|
||||
return 2
|
||||
fi
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user