Skip to content

Commit

Permalink
Switch to golangci-lint for the gocheck target
Browse files Browse the repository at this point in the history
Signed-off-by: Arjun Naik <anaik@redhat.com>
  • Loading branch information
Arjun Naik committed Aug 26, 2020
1 parent e1c4485 commit 8555eb1
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 96 deletions.
21 changes: 21 additions & 0 deletions boilerplate/_lib/ensure.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
set -euo pipefail

DEPENDENCY=${1:-}
VERSION=${2:-}
LOCATION=${3:-}

if [[ "${DEPENDENCY}" == "" || "${VERSION}" == "" || "${LOCATION}" == "" ]]; then
echo "$0 <dependency_name> <dependency_version> <path>"
exit 1
fi

case "${DEPENDENCY}" in
golangci-lint)
GOPATH=$(go env GOPATH)
if [ ! -f "${LOCATION}/golangci-lint" ]; then
DOWNLOAD_URL="https://github.com/golangci/golangci-lint/releases/download/v${VERSION}/golangci-lint-${VERSION}-linux-amd64.tar.gz"
curl -sfL "${DOWNLOAD_URL}" | tar -C "${GOPATH}/bin" -zx --strip-components=1 "golangci-lint-${VERSION}-linux-amd64/golangci-lint"
fi
;;
esac
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# options for analysis running
run:
# default concurrency is a available CPU number
concurrency: 10
# timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 2m
92 changes: 0 additions & 92 deletions boilerplate/openshift/golang_osd_cluster_operator/golint.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ docker-push: push

.PHONY: gocheck
gocheck: ## Lint code
boilerplate/openshift/golang_osd_cluster_operator/golint.sh
${GOENV} go vet ./cmd/... ./pkg/...
GOLANGCI_LINT_CACHE=/tmp/golangci-cache golangci-lint run -c boilerplate/openshift/golang_osd_cluster_operator/golangci.yml ./...

.PHONY: gogenerate
gogenerate:
Expand Down
7 changes: 5 additions & 2 deletions boilerplate/openshift/golang_osd_cluster_operator/update
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -e

source $CONVENTION_ROOT/_lib/common.sh
source "$CONVENTION_ROOT/_lib/common.sh"

HERE=${0%/*}

Expand All @@ -11,7 +11,10 @@ HERE=${0%/*}
[[ "$1" == "POST" ]] || err "Got a parameter I don't understand: '$1'. Did the infrastructure change?"

echo "Copying .codecov.yml to your repository root."
cp ${HERE}/.codecov.yml $REPO_ROOT
cp "${HERE}/.codecov.yml" "$REPO_ROOT"

echo "Ensuring golangci-lint is available on the \$PATH"
$CONVENTION_ROOT/_lib/ensure.sh golangci-lint

echo <<EOF
=====================
Expand Down

0 comments on commit 8555eb1

Please sign in to comment.