Pull request #2450: Update all

Merge in DNS/adguard-home from upd-all to master

Squashed commit of the following:

commit 72a41e9e2d9b9a5fbf24fa69322f9c4dcf3f5fb7
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Thu Aug 14 19:42:11 2025 +0300

    specs: export tests

commit aa729009306e492fd8a046b5e84f49be87e2a57f
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Thu Aug 14 19:19:54 2025 +0300

    all: upd golibs

commit 526ce744cfdf167d1e5b763422092e6f450993a6
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Thu Aug 14 17:21:57 2025 +0300

    all: upd scripts

commit ecc4312764b31e8b84e462321e3690a9b8eebbf6
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Thu Aug 14 17:02:53 2025 +0300

    all: upd go & tools
This commit is contained in:
Eugene Burkov
2025-08-14 20:33:05 +03:00
parent 49e2ad6799
commit 5e2b4405fd
49 changed files with 522 additions and 487 deletions

View File

@@ -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: 13
# AdGuard-Project-Version: 14
verbose="${VERBOSE:-0}"
readonly verbose
@@ -26,11 +26,11 @@ set -f -u
# Simple analyzers
# blocklist_imports is a simple check against unwanted packages. The following
# packages are banned:
# blocklist_imports is a simple best-effort check against unwanted packages.
# The following packages are banned:
#
# * Package errors is replaced by our own package in the
# github.com/AdguardTeam/golibs module.
# github.com/AdguardTeam/golibs module.
#
# * Packages log and github.com/AdguardTeam/golibs/log are replaced by
# stdlib's new package log/slog and AdGuard's new utilities package
@@ -67,7 +67,10 @@ set -f -u
#
# TODO(a.garipov): Add golibs/log.
blocklist_imports() {
find . \
import_or_tab="$(printf '^\\(import \\|\t\\)')"
readonly import_or_tab
find_with_ignore \
-type 'f' \
-name '*.go' \
'!' '(' \
@@ -77,16 +80,16 @@ blocklist_imports() {
-exec \
'grep' \
'-H' \
'-e' '[[:space:]]"errors"$' \
'-e' '[[:space:]]"github.com/prometheus/client_golang/prometheus/promauto"$' \
'-e' '[[:space:]]"golang.org/x/exp/maps"$' \
'-e' '[[:space:]]"golang.org/x/exp/slices"$' \
'-e' '[[:space:]]"golang.org/x/net/context"$' \
'-e' '[[:space:]]"io/ioutil"$' \
'-e' '[[:space:]]"log"$' \
'-e' '[[:space:]]"reflect"$' \
'-e' '[[:space:]]"sort"$' \
'-e' '[[:space:]]"unsafe"$' \
'-e' "$import_or_tab"'"errors"$' \
'-e' "$import_or_tab"'"github.com/prometheus/client_golang/prometheus/promauto"$' \
'-e' "$import_or_tab"'"golang.org/x/exp/maps"$' \
'-e' "$import_or_tab"'"golang.org/x/exp/slices"$' \
'-e' "$import_or_tab"'"golang.org/x/net/context"$' \
'-e' "$import_or_tab"'"io/ioutil"$' \
'-e' "$import_or_tab"'"log"$' \
'-e' "$import_or_tab"'"reflect"$' \
'-e' "$import_or_tab"'"sort"$' \
'-e' "$import_or_tab"'"unsafe"$' \
'-n' \
'{}' \
';'
@@ -94,8 +97,11 @@ blocklist_imports() {
# method_const is a simple check against the usage of some raw strings and
# numbers where one should use named constants.
#
# NOTE: Flag -H for grep is non-POSIX but all of Busybox, GNU, macOS, and
# OpenBSD support it.
method_const() {
find . \
find_with_ignore \
-type 'f' \
-name '*.go' \
-exec \
@@ -116,10 +122,11 @@ method_const() {
# use of filenames like client_manager.go.
underscores() {
underscore_files="$(
find . \
find_with_ignore \
-type 'f' \
-name '*_*.go' \
'!' '(' -name '*_bsd.go' \
'!' '(' \
-name '*_bsd.go' \
-o -name '*_darwin.go' \
-o -name '*_freebsd.go' \
-o -name '*_generate.go' \
@@ -206,13 +213,7 @@ run_linter ineffassign ./...
run_linter unparam ./...
find . \
'(' \
-name 'node_modules' \
-type 'd' \
-prune \
')' \
-o \
find_with_ignore \
-type 'f' \
'(' \
-name 'Makefile' \

View File

@@ -8,13 +8,13 @@
# 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
# Deferred helpers
not_found_msg='
looks like a binary not found error.
make sure you have installed the linter binaries using:
make sure you have installed the linter binaries, including using:
$ make go-tools
'
@@ -73,3 +73,41 @@ run_linter() (
return "$exitcode"
)
# find_with_ignore is a wrapper around find that does not descend into ignored
# directories, such as ./tmp/.
#
# NOTE: The arguments must contain on of -exec, -ok, or -print; see
# https://pubs.opengroup.org/onlinepubs/9799919799/utilities/find.html.
#
# TODO(a.garipov): Find a way to integrate the entire gitignore, including the
# global one, without using git, as .git is not copied into the build container.
#
# Keep in sync with .gitignore.
find_with_ignore() {
find . \
'(' \
-type 'd' \
'(' \
-name '.git' \
-o -path '/agh-backup' \
-o -path './bin' \
-o -path './build' \
-o -path './client/blob-report' \
-o -path './client/playwright-report' \
-o -path './client/playwright/.cache' \
-o -path './client/test-results' \
-o -path './data' \
-o -path './dist' \
-o -path './launchpad_credentials' \
-o -path './snapcraft_login' \
-o -name 'node_modules' \
-o -name 'test-reports' \
-o -name 'tmp' \
')' \
-prune \
')' \
-o \
"$@" \
;
}

View File

@@ -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: 8
# AdGuard-Project-Version: 9
verbose="${VERBOSE:-0}"
readonly verbose
@@ -33,19 +33,7 @@ trailing_newlines() (
nl="$(printf '\n')"
readonly nl
find . \
'(' \
-type 'd' \
'(' \
-name 'node_modules' \
-o -path './.git' \
-o -path './bin' \
-o -path './build' \
-o -path './client/playwright-report' \
')' \
-prune \
')' \
-o \
find_with_ignore \
-type 'f' \
'!' '(' \
-name '*.db' \
@@ -71,7 +59,7 @@ trailing_newlines() (
# trailing_whitespace is a simple check that makes sure that there are no
# trailing whitespace in plain-text files.
trailing_whitespace() {
find . \
find_with_ignore \
-type 'f' \
'!' '(' \
-name '*.db' \
@@ -84,11 +72,8 @@ trailing_whitespace() {
-o -name '*.zip' \
-o -name 'AdGuardHome' \
-o -name 'adguard-home' \
-o -path '*/node_modules/*' \
-o -path './.git/*' \
-o -path './bin/*' \
-o -path './build/*' \
')' \
-print \
| while read -r f; do
grep -e '[[:space:]]$' -n -- "$f" \
| sed -e "s:^:${f}\::" -e 's/ \+$/>>>&<<</'
@@ -99,12 +84,8 @@ run_linter -e trailing_newlines
run_linter -e trailing_whitespace
find . \
find_with_ignore \
-type 'f' \
'!' '(' \
-path '*/node_modules/*' \
-o -path './data/filters/*' \
')' \
'(' \
-name 'Makefile' \
-o -name '*.conf' \