summaryrefslogtreecommitdiff
path: root/hack/install_golangci.sh
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-03-05 19:28:10 +0100
committerGitHub <noreply@github.com>2020-03-05 19:28:10 +0100
commit60e9e7ca9c9081f31f6b37c922f0058f82b989ad (patch)
treeeaa56f2370e98e7c91a1d6c26944761d1fdb286a /hack/install_golangci.sh
parent36260286402a514417b642abd8f45a800f0dc9da (diff)
parentd0782e7839888d9eecdc97e8e885d5f787f5b8a7 (diff)
downloadpodman-60e9e7ca9c9081f31f6b37c922f0058f82b989ad.tar.gz
podman-60e9e7ca9c9081f31f6b37c922f0058f82b989ad.tar.bz2
podman-60e9e7ca9c9081f31f6b37c922f0058f82b989ad.zip
Merge pull request #5039 from cevich/fix_gobin_exit_bug
Cirrus: Fix gate image & false-positive exits
Diffstat (limited to 'hack/install_golangci.sh')
-rwxr-xr-xhack/install_golangci.sh24
1 files changed, 12 insertions, 12 deletions
diff --git a/hack/install_golangci.sh b/hack/install_golangci.sh
index 430685a71..6ef8ce823 100755
--- a/hack/install_golangci.sh
+++ b/hack/install_golangci.sh
@@ -1,17 +1,17 @@
#!/bin/bash
-if [ -z "$VERSION" ]; then
- echo \$VERSION is empty
- exit 1
-fi
+set -e
-if [ -z "$GOBIN" ]; then
- echo \$GOBIN is empty
- exit 1
-fi
+die() { echo "${1:-No error message given} (from $(basename $0))"; exit 1; }
+
+[ -n "$VERSION" ] || die "\$VERSION is empty or undefined"
+[ -n "$GOBIN" ] || die "\$GOBIN is empty or undefined"
-$GOBIN/golangci-lint --version | grep $VERSION
-if [ $? -ne 0 ]; then
- set -e
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $GOBIN v$VERSION
+BIN="$GOBIN/golangci-lint"
+if [ ! -x "$BIN" ]; then
+ echo "Installing golangci-lint v$VERSION into $GOBIN"
+ curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $GOBIN v$VERSION
+else
+ # Prints it's own file name as part of --verison output
+ echo "Using existing $(dirname $BIN)/$($BIN --version)"
fi