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

lburgazzoli pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/main by this push:
     new fe87df368 chore: cleanup golagci-lint configuration
fe87df368 is described below

commit fe87df368ca3bb05011b8d5cacaf4995f524586f
Author: Luca Burgazzoli <lburgazz...@gmail.com>
AuthorDate: Wed May 8 22:49:39 2024 +0200

    chore: cleanup golagci-lint configuration
---
 .golangci.yml   | 16 +---------------
 script/Makefile | 13 +++++++++++++
 2 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/.golangci.yml b/.golangci.yml
index da5216147..21b1f5b97 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -27,7 +27,6 @@ linters:
   enable-all: true
   disable:
     - cyclop
-    - deadcode
     - depguard
     - dupl
     - exhaustive
@@ -39,36 +38,22 @@ linters:
     - gochecknoglobals
     - gochecknoinits
     - gocognit
-    - goconst
     - gocyclo
     - godox
     - err113
     - gofumpt
-    - golint
     - gomnd
-    - gomoddirectives
-    - ifshort
-    - interfacer
     - ireturn
     - lll
-    - maligned
-    - nakedret
     - nestif
     - nilnil
     - nlreturn
     - nolintlint
-    - nosnakecase
     - paralleltest
     - revive
-    - rowserrcheck
-    - scopelint
-    - structcheck
-    - sqlclosecheck
     - tagalign
     - tagliatelle
-    - tenv
     - testpackage
-    - varcheck
     - varnamelen
     - wastedassign
     - whitespace
@@ -79,3 +64,4 @@ linters:
     #       lint violation make a lot of sense so we should re-enable the 
lints below and work to fix the findings
     - mnd
     - perfsprint
+    - goconst
diff --git a/script/Makefile b/script/Makefile
index db79a62ee..4740e028a 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -38,6 +38,7 @@ GOVULNCHECK_VERSION ?= latest
 
 LINTER ?= $(LOCALBIN)/golangci-lint
 GOVULNCHECK ?= $(LOCALBIN)/govulncheck
+GOIMPORT ?= $(LOCALBIN)/goimports
 
 BASE_IMAGE := eclipse-temurin:17
 LOCAL_REPOSITORY := /etc/maven/m2
@@ -443,6 +444,11 @@ lint-fix: golangci-lint
 vuln: govulncheck
        @$(GOVULNCHECK) ./...
 
+.PHONY: fmt
+fmt: goimport
+       $(GOIMPORT) -l -w .
+       go fmt ./...
+
 dir-licenses:
        ./script/vendor-license-directory.sh
 
@@ -743,3 +749,10 @@ govulncheck: $(GOVULNCHECK)
 $(GOVULNCHECK): $(LOCALBIN)
        @test -s $(GOVULNCHECK) || \
        GOBIN=$(LOCALBIN) go install 
golang.org/x/vuln/cmd/govulncheck@$(GOVULNCHECK_VERSION)
+
+.PHONY: goimport
+goimport: $(GOIMPORT)
+$(GOIMPORT): $(LOCALBIN)
+       @test -s $(LOCALBIN)/goimport || \
+       GOBIN=$(LOCALBIN) go install golang.org/x/tools/cmd/goimports@latest
+

Reply via email to