Merge PR #141: Upgrade golangci-lint to latest release (1.19.1)

This commit is contained in:
Alessio Treglia 2019-09-26 18:15:07 -07:00 committed by Alexander Bezobchuk
parent 3e3fae888d
commit 5e817641bb
2 changed files with 13 additions and 9 deletions

View File

@ -17,7 +17,6 @@ endif
GOPATH ?= $(shell $(GO) env GOPATH) GOPATH ?= $(shell $(GO) env GOPATH)
GITHUBDIR := $(GOPATH)$(FS)src$(FS)github.com GITHUBDIR := $(GOPATH)$(FS)src$(FS)github.com
GOLANGCI_LINT_VERSION := v1.18.0
GOLANGCI_LINT_HASHSUM := 8d21cc95da8d3daf8321ac40091456fc26123c964d7c2281d339d431f2f4c840 GOLANGCI_LINT_HASHSUM := 8d21cc95da8d3daf8321ac40091456fc26123c964d7c2281d339d431f2f4c840
### ###
@ -54,7 +53,7 @@ tools-stamp: $(RUNSIM)
$(GOLANGCI_LINT): $(mkfile_dir)/install-golangci-lint.sh $(GOLANGCI_LINT): $(mkfile_dir)/install-golangci-lint.sh
@echo "Installing golangci-lint..." @echo "Installing golangci-lint..."
@bash $(mkfile_dir)/install-golangci-lint.sh $(TOOLS_DESTDIR) $(GOLANGCI_LINT_VERSION) $(GOLANGCI_LINT_HASHSUM) @bash $(mkfile_dir)/install-golangci-lint.sh $(TOOLS_DESTDIR) $(GOLANGCI_LINT_HASHSUM)
# Install the runsim binary with a temporary workaround of entering an outside # Install the runsim binary with a temporary workaround of entering an outside
# directory as the "go get" command ignores the -mod option and will polute the # directory as the "go get" command ignores the -mod option and will polute the

View File

@ -2,19 +2,24 @@
set -euo pipefail set -euo pipefail
installer="$(mktemp)"
trap "rm -f ${installer}" EXIT
GOBIN="${1}"
CURL="$(which curl)"
HASHSUM="${2}"
f_sha256() { f_sha256() {
local l_file local l_file
l_file=$1 l_file=$1
python -sBc "import hashlib;print(hashlib.sha256(open('$l_file','rb').read()).hexdigest())" python -sBc "import hashlib;print(hashlib.sha256(open('$l_file','rb').read()).hexdigest())"
} }
installer="$(mktemp)" get_latest_release() {
trap "rm -f ${installer}" EXIT "${CURL}" --silent "https://api.github.com/repos/$1/releases/latest" | \
grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'
GOBIN="${1}" }
VERSION="${2}" VERSION="$(get_latest_release golangci/golangci-lint)"
HASHSUM="${3}"
CURL="$(which curl)"
echo "Downloading golangci-lint ${VERSION} installer ..." >&2 echo "Downloading golangci-lint ${VERSION} installer ..." >&2
"${CURL}" -sfL "https://raw.githubusercontent.com/golangci/golangci-lint/${VERSION}/install.sh" > "${installer}" "${CURL}" -sfL "https://raw.githubusercontent.com/golangci/golangci-lint/${VERSION}/install.sh" > "${installer}"