Pull request: all: imp go version setting and detection

Merge in DNS/adguard-home from imp-make to master

Squashed commit of the following:

commit 9ecb3422a55f5d010000bf4253a2766fefa67173
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Apr 22 19:59:36 2021 +0300

    all: fix spelling

commit c136f6562af80a67e627b472621ac68763f85fde
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Apr 22 19:50:07 2021 +0300

    all: imp go version setting and detection
This commit is contained in:
Ainar Garipov
2021-04-22 20:06:34 +03:00
parent 138dfaa85b
commit cb01eaa7f7
2 changed files with 38 additions and 13 deletions

View File

@@ -27,7 +27,7 @@ set -f -u
# Deferred Helpers
not_found_msg='
readonly not_found_msg='
looks like a binary not found error.
make sure you have installed the linter binaries using:
@@ -49,6 +49,29 @@ trap not_found EXIT
# Warnings
readonly go_min_version='go1.15'
readonly go_min_version_prefix="go version ${go_min_version}"
readonly go_version_msg="
warning: your go version different from the recommended minimal one (${go_min_version}).
if you have the version installed, please set the GO environment variable.
for example:
export GO='${go_min_version}'
"
case "$( "$GO" version )"
in
("$go_min_version_prefix"*)
# Go on.
;;
(*)
echo "$go_version_msg" 1>&2
;;
esac
# Simple Analyzers
# blocklist_imports is a simple check against unwanted packages.
@@ -99,7 +122,7 @@ exit_on_output() (
cmd="$1"
shift
output="$("$cmd" "$@" 2>&1)"
output="$( "$cmd" "$@" 2>&1 )"
exitcode="$?"
if [ "$exitcode" != '0' ]
then