diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index a3b265d..d9e1bb6 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -24,10 +24,10 @@ jobs: go-version: stable - uses: actions/checkout@v4 - name: golangci-lint - uses: golangci/golangci-lint-action@v6.5.0 + uses: golangci/golangci-lint-action@v8.0.0 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.64.5 + version: v2.5.0 # Optional: working directory, useful for monorepos # working-directory: somedir diff --git a/.golangci.yml b/.golangci.yml index 7319b4d..c4474e4 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,72 +1,90 @@ -# See https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml +# See https://golangci-lint.run/docs/linters/configuration/ +version: "2" run: tests: true - -linters-settings: - errcheck: - check-type-assertions: true - check-blank: true - gocyclo: - min-complexity: 20 - dupl: - threshold: 100 - misspell: - locale: US - unparam: - check-exported: true - funlen: - lines: 90 - cyclop: - max-complexity: 16 - linters: - enable-all: true + default: all disable: + - embeddedstructfieldcheck - testpackage - - gocognit - - gocyclo - - funlen - - nestif - - cyclop - - intrange + - noinlineerr + - wsl_v5 + - funcorder - copyloopvar - - lll - - gochecknoglobals - - wrapcheck - - paralleltest + - depguard + - dupword + - errname + - exhaustruct - forbidigo - forcetypeassert - - varnamelen - - tagliatelle - - errname + - gochecknoglobals + - intrange - ireturn - - exhaustruct + - lll + - mnd - nonamedreturns - - testableexamples - - dupword - - depguard + - paralleltest + - recvcheck - tagalign - - mnd + - tagliatelle + - testableexamples - testifylint - - recvcheck - -issues: - exclude-use-default: false - exclude-rules: - - linters: - - mnd - - goconst - - noctx - - funlen - - dupl - - unused - - unparam - path: "_test.go" - - linters: - - errcheck # Error checking omitted for brevity. - - gosec - path: "example_" - - linters: - - revive - text: "unused-parameter: parameter" - + - varnamelen + - wrapcheck + settings: + funlen: + lines: 150 + statements: 50 + cyclop: + max-complexity: 35 + gocognit: + min-complexity: 50 + nestif: + min-complexity: 12 + dupl: + threshold: 100 + errcheck: + check-type-assertions: true + check-blank: true + gocyclo: + min-complexity: 25 + misspell: + locale: US + unparam: + check-exported: true + exclusions: + generated: lax + rules: + - linters: + - gosec + - dupl + - funlen + - goconst + - mnd + - noctx + - unparam + - unused + path: _test.go + - linters: + - errcheck + - gosec + path: example_ + - linters: + - revive + text: 'unused-parameter: parameter' + paths: + - third_party$ + - builtin$ + - examples$ +formatters: + enable: + - gci + - gofmt + - gofumpt + - goimports + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ diff --git a/Makefile b/Makefile index 03bcc37..1e11310 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -#GOLANGCI_LINT_VERSION := "v1.64.5" # Optional configuration to pinpoint golangci-lint version. +#GOLANGCI_LINT_VERSION := "v2.5.0" # Optional configuration to pinpoint golangci-lint version. # The head of Makefile determines location of dev-go to include standard targets. GO ?= go @@ -27,15 +27,10 @@ ifeq ($(DEVGO_PATH),) endif endif - -BUILD_PKG = ./cmd/catp -BUILD_LDFLAGS=-s -w - -include $(DEVGO_PATH)/makefiles/main.mk -include $(DEVGO_PATH)/makefiles/lint.mk -include $(DEVGO_PATH)/makefiles/test-unit.mk --include $(DEVGO_PATH)/makefiles/build.mk --include $(DEVGO_PATH)/makefiles/release-assets.mk +-include $(DEVGO_PATH)/makefiles/bench.mk -include $(DEVGO_PATH)/makefiles/reset-ci.mk # Add your custom targets here. diff --git a/cmd/catp/catp/app.go b/cmd/catp/catp/app.go index 565f2c4..c561f11 100644 --- a/cmd/catp/catp/app.go +++ b/cmd/catp/catp/app.go @@ -157,7 +157,7 @@ func Main(options ...func(o *Options)) error { //nolint:funlen,cyclop,gocognit,g sort.Strings(files) - if *output != "" && r.outDir == "" { //nolint:nestif + if *output != "" && r.outDir == "" { fn := *output out, err := os.Create(fn) //nolint:gosec diff --git a/go.mod b/go.mod index a7ffa9e..1a15c42 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,12 @@ module github.com/bool64/progress -go 1.23.0 +go 1.24.0 require ( github.com/DataDog/zstd v1.5.7 - github.com/bool64/dev v0.2.40 + github.com/bool64/dev v0.2.43 github.com/cloudflare/ahocorasick v0.0.0-20240916140611-054963ec9396 - github.com/klauspost/compress v1.18.0 + github.com/klauspost/compress v1.18.2 github.com/klauspost/pgzip v1.2.6 - golang.org/x/time v0.12.0 + golang.org/x/time v0.14.0 ) diff --git a/go.sum b/go.sum index 9132398..5d4fe0b 100644 --- a/go.sum +++ b/go.sum @@ -1,12 +1,12 @@ github.com/DataDog/zstd v1.5.7 h1:ybO8RBeh29qrxIhCA9E8gKY6xfONU9T6G6aP9DTKfLE= github.com/DataDog/zstd v1.5.7/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= -github.com/bool64/dev v0.2.40 h1:LUSD+Aq+WB3KwVntqXstevJ0wB12ig1bEgoG8ZafsZU= -github.com/bool64/dev v0.2.40/go.mod h1:iJbh1y/HkunEPhgebWRNcs8wfGq7sjvJ6W5iabL8ACg= +github.com/bool64/dev v0.2.43 h1:yQ7qiZVef6WtCl2vDYU0Y+qSq+0aBrQzY8KXkklk9cQ= +github.com/bool64/dev v0.2.43/go.mod h1:iJbh1y/HkunEPhgebWRNcs8wfGq7sjvJ6W5iabL8ACg= github.com/cloudflare/ahocorasick v0.0.0-20240916140611-054963ec9396 h1:W2HK1IdCnCGuLUeyizSCkwvBjdj0ZL7mxnJYQ3poyzI= github.com/cloudflare/ahocorasick v0.0.0-20240916140611-054963ec9396/go.mod h1:tGWUZLZp9ajsxUOnHmFFLnqnlKXsCn6GReG4jAD59H0= -github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= -github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= +github.com/klauspost/compress v1.18.2 h1:iiPHWW0YrcFgpBYhsA6D1+fqHssJscY/Tm/y2Uqnapk= +github.com/klauspost/compress v1.18.2/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4= github.com/klauspost/pgzip v1.2.6 h1:8RXeL5crjEUFnR2/Sn6GJNWtSQ3Dk8pq4CL3jvdDyjU= github.com/klauspost/pgzip v1.2.6/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= -golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE= -golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= +golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI= +golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=