diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index dcfce69a..2ac63ec8 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -26,7 +26,7 @@ jobs: - uses: golangci/golangci-lint-action@v6 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. - version: v1.51 + version: v1.59 args: --timeout 10m github-token: ${{ secrets.GITHUB_TOKEN }} if: env.GIT_DIFF diff --git a/.golangci.yml b/.golangci.yml index dc5b2ce1..300ed9ca 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,30 +1,40 @@ linters: + disable-all: true enable: - - bodyclose - - dogsled - errcheck - - goconst - - gocritic - - gofmt - - goimports - - gosec - gosimple - govet - ineffassign - - misspell - - nakedret - - prealloc - staticcheck + - unused + - dogsled + - gosec + - gci + - gofumpt + - goconst + - gocritic + - nakedret + - nolintlint + - revive + - misspell - stylecheck - typecheck + - thelper - unconvert + - asasalint + - asciicheck + - bidichk + - bodyclose + - copyloopvar + - errchkjson + - errorlint + - tenv + - wastedassign + - fatcontext + - dupl - unparam - - unused - gocyclo - - whitespace - - dupl - - revive - - exportloopref + - prealloc issues: exclude-rules: @@ -57,6 +67,12 @@ linters-settings: # Default is to use a neutral variety of English. # Setting locale to US will correct the British spelling of 'colour' to 'color'. locale: US + gci: + custom-order: true + sections: + - standard # Standard section: captures all standard packages. + - default # Default section: contains all imports that could not be matched to another section type. + - prefix(github.com/Finschia/finschia-sdk) run: # default concurrency is a available CPU number concurrency: 4 diff --git a/Makefile b/Makefile index dfd733f7..58d16ca6 100644 --- a/Makefile +++ b/Makefile @@ -217,10 +217,13 @@ docker-build: ### Linting ### ############################################################################### -lint: - golangci-lint run +lint: golangci-lint + golangci-lint run --out-format=tab find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" | xargs gofmt -d -s +golangci-lint: + @go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.59 + format: find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" | xargs gofmt -w -s find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" | xargs misspell -w