From d104a286243bd638a4503ba468598a7c7ee9627e Mon Sep 17 00:00:00 2001 From: Jean Mertz Date: Fri, 2 Nov 2018 09:18:46 +0100 Subject: [PATCH] Install latest stable gometalinter on CI This prevents intermittent linting issues on CI when gometalinter (master) is changed. --- script/bootstrap | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/script/bootstrap b/script/bootstrap index a15a347..1ab91bb 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -6,14 +6,14 @@ set -e cd "$(dirname "$0")/.." +os=$(uname -s | awk '{print tolower($0)}') + if [ -n "$CI" ] || ! command -v dep >/dev/null 2>&1; then - os=$(uname -s | awk '{print tolower($0)}') curl -L "https://github.com/golang/dep/releases/download/v0.5.0/dep-$os-amd64" >"$GOPATH/bin/dep" chmod +x "$GOPATH/bin/dep" fi if [ -n "$CI" ] || ! command -v shellcheck >/dev/null 2>&1; then - os=$(uname -s | awk '{print tolower($0)}') if [ "$os" = "darwin" ]; then echo >&2 "You need to install shellcheck before continuing." fi @@ -28,11 +28,21 @@ if [ -n "$CI" ] || ! command -v shellcheck >/dev/null 2>&1; then fi if [ -n "$CI" ] || ! command -v shfmt >/dev/null 2>&1; then - os=$(uname -s | awk '{print tolower($0)}') curl -L "https://github.com/mvdan/sh/releases/download/v2.5.0/shfmt_v2.5.0_${os}_amd64" >"$GOPATH/bin/shfmt" chmod +x "$GOPATH/bin/shfmt" fi -go get -u github.com/alecthomas/gometalinter -gometalinter --install +if [ -n "$CI" ] || ! command -v gometalinter >/dev/null 2>&1; then + if [ "$os" = "darwin" ]; then + echo >&2 "You need to install gometalinter before continuing." + fi + + tmp=$(mktemp -d) + curl -Ls "https://github.com/alecthomas/gometalinter/releases/download/v2.0.11/gometalinter-2.0.11-$os-amd64.tar.gz" | + tar xzf - --strip 1 -C "$tmp" + + mkdir -p "$GOPATH/bin" + cp "$tmp/*" "$GOPATH/bin/" + chmod +x "$GOPATH/bin/*" +fi