Install golangci-lint if needed

Currently, `golangci-lint` is using in `make test-style` step, but there is no installation step for this tool. It will raise an error in the case of `golangci-lint` is not installed in the local env. This PR aim to install it if needed.

Signed-off-by: Kim Bao Long <longkb@vn.fujitsu.com>
pull/7695/head
Kim Bao Long 6 years ago
parent 4c55073da4
commit 41230b176d

@ -15,7 +15,7 @@ jobs:
- checkout
- run:
name: install test dependencies
command: .circleci/bootstrap.sh
command: make lint
- run:
name: test style
command: make test-style

@ -10,6 +10,8 @@ GOX = $(GOPATH)/bin/gox
GOIMPORTS = $(GOPATH)/bin/goimports
ARCH = $(shell uname -p)
GOLANGCI_LINT_VERSION = "1.21.0"
ACCEPTANCE_DIR:=../acceptance-testing
# To specify the subset of acceptance tests to run. '.' means all tests
ACCEPTANCE_RUN_TESTS=.
@ -89,10 +91,19 @@ test-coverage:
@ ./scripts/coverage.sh
.PHONY: test-style
test-style:
test-style: lint
GO111MODULE=on golangci-lint run
@scripts/validate-license.sh
.PHONY: lint
lint:
set -euo pipefail
cd /
GO111MODULE=on
curl -sSL https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCI_LINT_VERSION}/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz | tar xz
sudo mv golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64/golangci-lint /usr/local/bin/golangci-lint
rm -rf golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64
.PHONY: test-acceptance
test-acceptance: TARGETS = linux/amd64
test-acceptance: build build-cross

Loading…
Cancel
Save