2020-12-08 15:23:35 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2023-02-21 14:07:12 +00:00
|
|
|
# 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.
|
|
|
|
#
|
2024-08-20 16:38:04 +01:00
|
|
|
# AdGuard-Project-Version: 4
|
2023-02-21 14:07:12 +00:00
|
|
|
|
2020-12-30 15:26:25 +00:00
|
|
|
verbose="${VERBOSE:-0}"
|
2021-05-19 18:31:20 +01:00
|
|
|
readonly verbose
|
2020-12-30 15:26:25 +00:00
|
|
|
|
2021-01-15 17:30:48 +00:00
|
|
|
if [ "$verbose" -gt '1' ]
|
2020-12-30 15:26:25 +00:00
|
|
|
then
|
|
|
|
set -x
|
2023-02-21 14:07:12 +00:00
|
|
|
v_flags='-v=1'
|
|
|
|
x_flags='-x=1'
|
2021-01-15 17:30:48 +00:00
|
|
|
elif [ "$verbose" -gt '0' ]
|
|
|
|
then
|
|
|
|
set -x
|
2023-02-21 14:07:12 +00:00
|
|
|
v_flags='-v=1'
|
|
|
|
x_flags='-x=0'
|
2021-01-15 17:30:48 +00:00
|
|
|
else
|
|
|
|
set +x
|
2023-02-21 14:07:12 +00:00
|
|
|
v_flags='-v=0'
|
|
|
|
x_flags='-x=0'
|
2020-12-30 15:26:25 +00:00
|
|
|
fi
|
2021-05-19 18:31:20 +01:00
|
|
|
readonly v_flags x_flags
|
2020-12-30 15:26:25 +00:00
|
|
|
|
2020-12-08 15:23:35 +00:00
|
|
|
set -e -f -u
|
|
|
|
|
2021-01-15 17:30:48 +00:00
|
|
|
go="${GO:-go}"
|
2021-05-19 18:31:20 +01:00
|
|
|
readonly go
|
2021-01-15 17:30:48 +00:00
|
|
|
|
2023-02-21 14:07:12 +00:00
|
|
|
# Remove only the actual binaries in the bin/ directory, as developers may add
|
|
|
|
# their own scripts there. Most commonly, a script named “go” for tools that
|
|
|
|
# call the go binary and need a particular version.
|
|
|
|
rm -f\
|
|
|
|
bin/errcheck\
|
|
|
|
bin/fieldalignment\
|
2023-06-19 10:21:32 +01:00
|
|
|
bin/gocognit\
|
2023-02-21 14:07:12 +00:00
|
|
|
bin/gocyclo\
|
|
|
|
bin/gofumpt\
|
|
|
|
bin/gosec\
|
|
|
|
bin/govulncheck\
|
|
|
|
bin/ineffassign\
|
|
|
|
bin/misspell\
|
|
|
|
bin/nilness\
|
|
|
|
bin/shadow\
|
|
|
|
bin/staticcheck\
|
|
|
|
bin/unparam\
|
|
|
|
;
|
|
|
|
|
2021-01-15 17:30:48 +00:00
|
|
|
# Reset GOARCH and GOOS to make sure we install the tools for the native
|
2021-05-19 18:31:20 +01:00
|
|
|
# architecture even when we're cross-compiling the main binary, and also to
|
|
|
|
# prevent the "cannot install cross-compiled binaries when GOBIN is set" error.
|
2021-01-15 17:30:48 +00:00
|
|
|
env\
|
|
|
|
GOARCH=""\
|
|
|
|
GOBIN="${PWD}/bin"\
|
2022-09-07 12:01:03 +01:00
|
|
|
GOOS=""\
|
|
|
|
GOWORK='off'\
|
|
|
|
"$go" install\
|
|
|
|
--modfile=./internal/tools/go.mod\
|
2023-02-21 14:07:12 +00:00
|
|
|
"$v_flags"\
|
|
|
|
"$x_flags"\
|
2020-12-08 15:23:35 +00:00
|
|
|
github.com/fzipp/gocyclo/cmd/gocyclo\
|
|
|
|
github.com/golangci/misspell/cmd/misspell\
|
|
|
|
github.com/gordonklaus/ineffassign\
|
|
|
|
github.com/kisielk/errcheck\
|
|
|
|
github.com/securego/gosec/v2/cmd/gosec\
|
2023-06-19 10:21:32 +01:00
|
|
|
github.com/uudashr/gocognit/cmd/gocognit\
|
2023-02-21 14:07:12 +00:00
|
|
|
golang.org/x/tools/go/analysis/passes/fieldalignment/cmd/fieldalignment\
|
2020-12-08 15:23:35 +00:00
|
|
|
golang.org/x/tools/go/analysis/passes/nilness/cmd/nilness\
|
|
|
|
golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow\
|
2022-09-07 12:01:03 +01:00
|
|
|
golang.org/x/vuln/cmd/govulncheck\
|
2020-12-08 15:23:35 +00:00
|
|
|
honnef.co/go/tools/cmd/staticcheck\
|
|
|
|
mvdan.cc/gofumpt\
|
|
|
|
mvdan.cc/unparam\
|
|
|
|
;
|