Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to golangci-lint for the gocheck target #3

Merged
merged 2 commits into from
Aug 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions boilerplate/_lib/ensure.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
set -euo pipefail

GOLANGCI_LINT_VERSION="1.30.0"
DEPENDENCY=${1:-}

case "${DEPENDENCY}" in
golangci-lint)
arjunrn marked this conversation as resolved.
Show resolved Hide resolved
GOPATH=$(go env GOPATH)
if [ ! -f "${GOPATH}/bin/golangci-lint" ]; then
DOWNLOAD_URL="https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCI_LINT_VERSION}/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz"
curl -sfL "${DOWNLOAD_URL}" | tar -C "${GOPATH}/bin" -zx --strip-components=1 "golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64/golangci-lint"
fi
;;
*)
echo "Unknown dependency: ${DEPENDENCY}"
exit 1
;;
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.

6 changes: 4 additions & 2 deletions boilerplate/openshift/golang_osd_cluster_operator/standard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ docker-push: push

.PHONY: gocheck
gocheck: ## Lint code
boilerplate/openshift/golang_osd_cluster_operator/golint.sh
${GOENV} go vet ./cmd/... ./pkg/...
boilerplate/_lib/ensure.sh golangci-lint
# GOLANGCI_LINT_CACHE needs to be set to a directory which is writeable
# Relevant issue - https://github.com/golangci/golangci-lint/issues/734
GOLANGCI_LINT_CACHE=/tmp/golangci-cache golangci-lint run -c boilerplate/openshift/golang_osd_cluster_operator/golangci.yml ./...
arjunrn marked this conversation as resolved.
Show resolved Hide resolved

.PHONY: gogenerate
gogenerate:
Expand Down