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:
parent
138dfaa85b
commit
cb01eaa7f7
24
Makefile
24
Makefile
|
@ -7,13 +7,15 @@
|
||||||
CHANNEL = development
|
CHANNEL = development
|
||||||
CLIENT_BETA_DIR = client2
|
CLIENT_BETA_DIR = client2
|
||||||
CLIENT_DIR = client
|
CLIENT_DIR = client
|
||||||
COMMIT = $$(git rev-parse --short HEAD)
|
COMMIT = $$( git rev-parse --short HEAD )
|
||||||
DIST_DIR = dist
|
DIST_DIR = dist
|
||||||
# TODO(a.garipov): Find out a way to make this work in GNU Make.
|
# Don't name this macro "GO", because GNU Make apparenly makes it an
|
||||||
|
# exported environment variable with the literal value of "${GO:-go}",
|
||||||
|
# which is not what we need. Use a dot in the name to make sure that
|
||||||
|
# users don't have an environment variable with the same name.
|
||||||
#
|
#
|
||||||
# GO = $${GO:-go}
|
# See https://unix.stackexchange.com/q/646255/105635.
|
||||||
#
|
GO.MACRO = $${GO:-go}
|
||||||
GO = go
|
|
||||||
GOPROXY = https://goproxy.cn|https://proxy.golang.org|direct
|
GOPROXY = https://goproxy.cn|https://proxy.golang.org|direct
|
||||||
GPG_KEY = devteam@adguard.com
|
GPG_KEY = devteam@adguard.com
|
||||||
GPG_KEY_PASSPHRASE = not-a-real-password
|
GPG_KEY_PASSPHRASE = not-a-real-password
|
||||||
|
@ -37,9 +39,9 @@ ENV = env\
|
||||||
GPG_KEY='$(GPG_KEY)'\
|
GPG_KEY='$(GPG_KEY)'\
|
||||||
GPG_KEY_PASSPHRASE='$(GPG_KEY_PASSPHRASE)'\
|
GPG_KEY_PASSPHRASE='$(GPG_KEY_PASSPHRASE)'\
|
||||||
DIST_DIR='$(DIST_DIR)'\
|
DIST_DIR='$(DIST_DIR)'\
|
||||||
GO='$(GO)'\
|
GO="$(GO.MACRO)"\
|
||||||
GOPROXY='$(GOPROXY)'\
|
GOPROXY='$(GOPROXY)'\
|
||||||
PATH="$${PWD}/bin:$$($(GO) env GOPATH)/bin:$${PATH}"\
|
PATH="$${PWD}/bin:$$( "$(GO.MACRO)" env GOPATH )/bin:$${PATH}"\
|
||||||
RACE='$(RACE)'\
|
RACE='$(RACE)'\
|
||||||
SIGN='$(SIGN)'\
|
SIGN='$(SIGN)'\
|
||||||
VERBOSE='$(VERBOSE)'\
|
VERBOSE='$(VERBOSE)'\
|
||||||
|
@ -97,10 +99,10 @@ go-check: go-tools go-lint go-test
|
||||||
# A quick check to make sure that all supported operating systems can be
|
# A quick check to make sure that all supported operating systems can be
|
||||||
# typechecked and built successfully.
|
# typechecked and built successfully.
|
||||||
go-os-check:
|
go-os-check:
|
||||||
env GOOS='darwin' $(GO) vet ./internal/...
|
env GOOS='darwin' "$(GO.MACRO)" vet ./internal/...
|
||||||
env GOOS='freebsd' $(GO) vet ./internal/...
|
env GOOS='freebsd' "$(GO.MACRO)" vet ./internal/...
|
||||||
env GOOS='linux' $(GO) vet ./internal/...
|
env GOOS='linux' "$(GO.MACRO)" vet ./internal/...
|
||||||
env GOOS='windows' $(GO) vet ./internal/...
|
env GOOS='windows' "$(GO.MACRO)" vet ./internal/...
|
||||||
|
|
||||||
openapi-lint: ; cd ./openapi/ && $(YARN) test
|
openapi-lint: ; cd ./openapi/ && $(YARN) test
|
||||||
openapi-show: ; cd ./openapi/ && $(YARN) start
|
openapi-show: ; cd ./openapi/ && $(YARN) start
|
||||||
|
|
|
@ -27,7 +27,7 @@ set -f -u
|
||||||
|
|
||||||
# Deferred Helpers
|
# Deferred Helpers
|
||||||
|
|
||||||
not_found_msg='
|
readonly not_found_msg='
|
||||||
looks like a binary not found error.
|
looks like a binary not found error.
|
||||||
make sure you have installed the linter binaries using:
|
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
|
# Simple Analyzers
|
||||||
|
|
||||||
# blocklist_imports is a simple check against unwanted packages.
|
# blocklist_imports is a simple check against unwanted packages.
|
||||||
|
@ -99,7 +122,7 @@ exit_on_output() (
|
||||||
cmd="$1"
|
cmd="$1"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
output="$("$cmd" "$@" 2>&1)"
|
output="$( "$cmd" "$@" 2>&1 )"
|
||||||
exitcode="$?"
|
exitcode="$?"
|
||||||
if [ "$exitcode" != '0' ]
|
if [ "$exitcode" != '0' ]
|
||||||
then
|
then
|
||||||
|
|
Loading…
Reference in New Issue