@@ -11,12 +11,12 @@ if [[ -z "${TT_REPO}" ]]; then
11
11
TT_REPO=" https://github.com/tarantool/tarantool.git"
12
12
fi
13
13
14
- TT_DIR=tarantool
14
+ TT_DIR=tarantool- $TT_TAG
15
15
16
16
# Cleanup.
17
17
rm -rf ${TT_DIR}
18
18
19
- git clone --depth 1 --branch ${TT_TAG} ${TT_REPO} -o ${TT_DIR}
19
+ git clone --depth 1 --branch ${TT_TAG} ${TT_REPO} ${TT_DIR}
20
20
cd ${TT_DIR}
21
21
TT_COMMIT=$( git log -n 1 | head -n 1 | sed " s/commit //" )
22
22
cd ..
@@ -233,19 +233,22 @@ type Error int
233
233
const (
234
234
EOF
235
235
236
- grep " (ER_" ${SRC_ERRORS} | \
237
- # Remove comments symbols.
238
- sed " s/\/\*//" | \
239
- sed " s/\*\/_(//" | \
240
- # Remove and of values.
241
- sed " s/) *\\ \//" | \
242
- # Remove comma at an end of a value.
243
- sed " s/,/ /" | \
244
- # Finally print parsed values in Golang format.
245
- awk ' {
236
+ # Extract body of define ERROR_CODES
237
+ ERROR_CODES=` sed -n ' /^#define ERROR_CODES(/,/This one should be last/{//!p;}' ${SRC_ERRORS} `
238
+
239
+ echo " ${ERROR_CODES} " | \
240
+ # Get line with ER_* description
241
+ sed -nE ' s/^[^E]*(ER_.+)\s*\\\s*$/\1/p' | \
242
+ # Remove trailing parenthesis or comment's ending
243
+ sed -E ' s/(.*)\s*(:?\)|\*\/)\s*$/\1/' | \
244
+ awk '
245
+ BEGIN{ FS=",[[:space:]]*" }
246
+ {
247
+ length_limit = 100-(4+3) # line_limit - (tab_size + len("// "))
246
248
com="";
247
- for(i=3;i<=NF;i++){com=com" "$i};
248
- printf("\t//%s\n\t%s Error = %s\n", com, $2, $1)
249
+ for(i=3; i<=NF; i++){ com=com" "$i };
250
+ if(length(com) > length_limit) { print "\t// nolint:lll" }
251
+ printf("\t//%s\n\t%s Error = %s\n", com, $1, $2)
249
252
}' >> ${DST_ERRORS}
250
253
251
254
echo " )" >> ${DST_ERRORS}
@@ -259,7 +262,7 @@ func TestError(t *testing.T) {
259
262
} {
260
263
EOF
261
264
262
- grep -o " ER_[A-Z0-9_]\+," ${SRC_ERRORS} | \
265
+ echo " ${ERROR_CODES} " | grep -o " ER_[A-Z0-9_]\+," | \
263
266
sed " s/,$//" | \
264
267
awk ' {printf("\t\t{iproto.%s, \"%s\"},\n", $1, $1)}' >> ${DST_ERRORS_TEST}
265
268
0 commit comments