This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch feature-triple
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git


The following commit(s) were added to refs/heads/feature-triple by this push:
     new 0bde3bae7 update makefile, add lint support
0bde3bae7 is described below

commit 0bde3bae7904e132f30e2e1ac80884363601c8a8
Author: chickenlj <[email protected]>
AuthorDate: Wed Oct 11 21:13:00 2023 +0800

    update makefile, add lint support
---
 Makefile | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/Makefile b/Makefile
index 233ba5337..b7eb2b6ba 100644
--- a/Makefile
+++ b/Makefile
@@ -73,6 +73,22 @@ fmt:
        $(GO_GET) -u github.com/dubbogo/tools/cmd/imports-formatter
        imports-formatter
 
+LOCALBIN ?= $(shell pwd)/bin
+$(LOCALBIN):
+       mkdir -p $(LOCALBIN)
+GOLANG_LINT_VERSION ?= v1.44.2
+GOLANG_LINT ?= $(LOCALBIN)/golangci-lint
+GOLANG_LINT_INSTALL_SCRIPT ?= 
"https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh";
+
+.PHONY: golangci-lint-install
+golangci-lint-install: $(LOCALBIN) ## Download golangci lint locally if 
necessary.
+       test -s $(LOCALBIN)/golangci-lint  && $(LOCALBIN)/golangci-lint 
--version | grep -q $(GOLANG_LINT_VERSION) || \
+       GOBIN=$(LOCALBIN) go install 
github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANG_LINT_VERSION)
+
+.PHONY: lint
+lint: golangci-lint-install  ## Run golang lint against code
+       GO111MODULE=on $(GOLANG_LINT) run ./... --timeout=30m -v
+
 .PHONY: clean
 clean: prepare
        rm -rf coverage.txt

Reply via email to