diff --git a/internal/filtering/rewrite/item_internal_test.go b/internal/filtering/rewrite/item_internal_test.go index 68d88223..a63b2cea 100644 --- a/internal/filtering/rewrite/item_internal_test.go +++ b/internal/filtering/rewrite/item_internal_test.go @@ -18,9 +18,9 @@ func TestItem_equal(t *testing.T) { } testCases := []struct { - name string left *Item right *Item + name string want bool }{{ name: "nil_left", diff --git a/scripts/make/go-lint.sh b/scripts/make/go-lint.sh index ae230d15..e89eca6d 100644 --- a/scripts/make/go-lint.sh +++ b/scripts/make/go-lint.sh @@ -3,7 +3,7 @@ # 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. # -# AdGuard-Project-Version: 4 +# AdGuard-Project-Version: 5 verbose="${VERBOSE:-0}" readonly verbose @@ -238,7 +238,32 @@ run_linter looppointer ./... 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 ./... diff --git a/scripts/make/go-tools.sh b/scripts/make/go-tools.sh index f9ccb42f..fdb70f86 100644 --- a/scripts/make/go-tools.sh +++ b/scripts/make/go-tools.sh @@ -3,7 +3,7 @@ # 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. # -# AdGuard-Project-Version: 2 +# AdGuard-Project-Version: 3 verbose="${VERBOSE:-0}" readonly verbose diff --git a/scripts/make/helper.sh b/scripts/make/helper.sh index 6d7fe778..9c4ff88b 100644 --- a/scripts/make/helper.sh +++ b/scripts/make/helper.sh @@ -8,7 +8,7 @@ # 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. # -# AdGuard-Project-Version: 2 +# AdGuard-Project-Version: 3 @@ -47,7 +47,7 @@ trap not_found EXIT run_linter() ( set +e - if [ "$VERBOSE" -lt '2' ] + if [ "${VERBOSE:-0}" -lt '2' ] then set +x fi diff --git a/scripts/make/txt-lint.sh b/scripts/make/txt-lint.sh index 74d5758d..578297ec 100644 --- a/scripts/make/txt-lint.sh +++ b/scripts/make/txt-lint.sh @@ -3,7 +3,7 @@ # 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. # -# AdGuard-Project-Version: 4 +# AdGuard-Project-Version: 5 verbose="${VERBOSE:-0}" readonly verbose @@ -31,7 +31,7 @@ set -f -u # 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. -trailing_newlines() { +trailing_newlines() ( nl="$( printf "\n" )" readonly nl @@ -42,12 +42,13 @@ trailing_newlines() { ':!*.zip'\ | while read -r f do - if [ "$( tail -c -1 "$f" )" != "$nl" ] + final_byte="$( tail -c -1 "$f" )" + if [ "$final_byte" != "$nl" ] then printf '%s: must have a trailing newline\n' "$f" fi done -} +) # trailing_whitespace is a simple check that makes sure that there are no # trailing whitespace in plain-text files.