Pull request 1998: upd-proj-skel

Squashed commit of the following:

commit 5cc2914b18fd71ff83e2872ef6755f2ff56d653c
Merge: bf14a513e 085b4fdce
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Thu Sep 7 14:58:44 2023 +0300

    Merge branch 'master' into upd-proj-skel

commit bf14a513eb46ebf2c2809246603b071e6c334e9f
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Thu Sep 7 14:47:10 2023 +0300

    all: imp code

commit ec3f7a88b86b3f423193aa95c2e820bcd86fdef3
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Thu Sep 7 14:28:39 2023 +0300

    scripts: upd go lint

commit 6a9342f6058bc21252f97045f7015440f013cb09
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Thu Sep 7 14:13:17 2023 +0300

    all: upd proj skel
This commit is contained in:
Stanislav Chzhen 2023-09-07 15:05:21 +03:00
parent 085b4fdcea
commit 3b846bae6e
5 changed files with 36 additions and 10 deletions

View File

@ -18,9 +18,9 @@ func TestItem_equal(t *testing.T) {
} }
testCases := []struct { testCases := []struct {
name string
left *Item left *Item
right *Item right *Item
name string
want bool want bool
}{{ }{{
name: "nil_left", name: "nil_left",

View File

@ -3,7 +3,7 @@
# This comment is used to simplify checking local copies of the script. Bump # This comment is used to simplify checking local copies of the script. Bump
# this number every time a significant change is made to this script. # this number every time a significant change is made to this script.
# #
# AdGuard-Project-Version: 4 # AdGuard-Project-Version: 5
verbose="${VERBOSE:-0}" verbose="${VERBOSE:-0}"
readonly verbose readonly verbose
@ -238,7 +238,32 @@ run_linter looppointer ./...
run_linter nilness ./... run_linter nilness ./...
# TODO(a.garipov): Add fieldalignment? # TODO(a.garipov): Enable for all.
run_linter fieldalignment \
./internal/aghalg/\
./internal/aghchan/\
./internal/aghhttp/\
./internal/aghio/\
./internal/aghos/\
./internal/aghrenameio/\
./internal/aghtest/\
./internal/aghtls/\
./internal/arpdb/\
./internal/client/\
./internal/confmigrate/\
./internal/dhcpsvc/\
./internal/filtering/hashprefix/\
./internal/filtering/rewrite/\
./internal/filtering/rulelist/\
./internal/filtering/safesearch/\
./internal/next/...\
./internal/querylog/\
./internal/rdns/\
./internal/stats/\
./internal/updater/\
./internal/version/\
./internal/whois/\
;
run_linter -e shadow --strict ./... run_linter -e shadow --strict ./...

View File

@ -3,7 +3,7 @@
# This comment is used to simplify checking local copies of the script. Bump # This comment is used to simplify checking local copies of the script. Bump
# this number every time a significant change is made to this script. # this number every time a significant change is made to this script.
# #
# AdGuard-Project-Version: 2 # AdGuard-Project-Version: 3
verbose="${VERBOSE:-0}" verbose="${VERBOSE:-0}"
readonly verbose readonly verbose

View File

@ -8,7 +8,7 @@
# This comment is used to simplify checking local copies of the script. Bump # This comment is used to simplify checking local copies of the script. Bump
# this number every time a remarkable change is made to this script. # this number every time a remarkable change is made to this script.
# #
# AdGuard-Project-Version: 2 # AdGuard-Project-Version: 3
@ -47,7 +47,7 @@ trap not_found EXIT
run_linter() ( run_linter() (
set +e set +e
if [ "$VERBOSE" -lt '2' ] if [ "${VERBOSE:-0}" -lt '2' ]
then then
set +x set +x
fi fi

View File

@ -3,7 +3,7 @@
# This comment is used to simplify checking local copies of the script. Bump # This comment is used to simplify checking local copies of the script. Bump
# this number every time a remarkable change is made to this script. # this number every time a remarkable change is made to this script.
# #
# AdGuard-Project-Version: 4 # AdGuard-Project-Version: 5
verbose="${VERBOSE:-0}" verbose="${VERBOSE:-0}"
readonly verbose readonly verbose
@ -31,7 +31,7 @@ set -f -u
# trailing_newlines is a simple check that makes sure that all plain-text files # trailing_newlines is a simple check that makes sure that all plain-text files
# have a trailing newlines to make sure that all tools work correctly with them. # have a trailing newlines to make sure that all tools work correctly with them.
trailing_newlines() { trailing_newlines() (
nl="$( printf "\n" )" nl="$( printf "\n" )"
readonly nl readonly nl
@ -42,12 +42,13 @@ trailing_newlines() {
':!*.zip'\ ':!*.zip'\
| while read -r f | while read -r f
do do
if [ "$( tail -c -1 "$f" )" != "$nl" ] final_byte="$( tail -c -1 "$f" )"
if [ "$final_byte" != "$nl" ]
then then
printf '%s: must have a trailing newline\n' "$f" printf '%s: must have a trailing newline\n' "$f"
fi fi
done done
} )
# trailing_whitespace is a simple check that makes sure that there are no # trailing_whitespace is a simple check that makes sure that there are no
# trailing whitespace in plain-text files. # trailing whitespace in plain-text files.