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

Update golangci-lint in Makefile #17647

Merged
merged 8 commits into from
Nov 17, 2021
Merged
Changes from 4 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
17 changes: 14 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ COMMA := ,
XGO_VERSION := go-1.17.x
MIN_GO_VERSION := 001016000
MIN_NODE_VERSION := 012017000
MIN_GOLANGCI_LINT_VERSION := 1.43.0

DOCKER_IMAGE ?= gitea/gitea
DOCKER_TAG ?= latest
Expand Down Expand Up @@ -765,12 +766,22 @@ pr\#%: clean-all
$(GO) run contrib/pr/checkout.go $*

.PHONY: golangci-lint
golangci-lint:
golangci-lint: golangci-lint-check
golangci-lint run --timeout 10m

.PHONY: golangci-lint-check
golangci-lint-check:
$(eval GOLANGCI_LINT_VERSION := $(shell printf "%03d%03d%03d" $(shell golangci-lint --version | grep -Eo '[0-9]+\.[0-9.]+' | tr '.' ' ');))
@hash golangci-lint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
echo "Downloading golangci-lint"; \
Gusted marked this conversation as resolved.
Show resolved Hide resolved
export BINARY="golangci-lint"; \
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOPATH)/bin v1.37.0; \
curl -sfL "https://raw.githubusercontent.com/golangci/golangci-lint/v${MIN_GOLANGCI_LINT_VERSION}/install.sh" | sh -s -- -b $(GOPATH)/bin v$(MIN_GOLANGCI_LINT_VERSION); \
elif [ "$(GOLANGCI_LINT_VERSION)" -lt "$(shell printf "%03d%03d%03d" $(shell echo $(MIN_GOLANGCI_LINT_VERSION) | tr '.' ' '))" ]; then \
echo "Downloading newer version of golangci-lint"; \
export BINARY="golangci-lint"; \
echo "https://raw.githubusercontent.com/golangci/golangci-lint/v${MIN_GOLANGCI_LINT_VERSION}/install.sh"; \
curl -sfL "https://raw.githubusercontent.com/golangci/golangci-lint/v${MIN_GOLANGCI_LINT_VERSION}/install.sh" | sh -s -- -b $(GOPATH)/bin v$(MIN_GOLANGCI_LINT_VERSION); \
fi
golangci-lint run --timeout 10m

.PHONY: docker
docker:
Expand Down