# HG changeset patch # User Axel Prel <axel.prel@xcg-consulting.fr> # Date 1738071163 -3600 # Tue Jan 28 14:32:43 2025 +0100 # Node ID 39d581a5fb244b661d909c3a55e3ad4a2f135fbd # Parent 0b4839bf84be0f783b15f448ca7edcb935fc7e0d golangCI 1.64.6 diff --git a/.golangci.yml b/.golangci.yml --- a/.golangci.yml +++ b/.golangci.yml @@ -7,12 +7,17 @@ enable: # enable by default linters - errcheck + # Errcheck is a program for checking for unchecked errors in Go code. These unchecked errors can be critical bugs in some cases. - gosimple + # Linter for Go source code that specializes in simplifying code. [auto-fix] - govet + # Vet examines Go source code and reports suspicious constructs. It is roughly the same as 'go vet' and uses its passes. [auto-fix] - ineffassign + # Detects when assignments to existing variables are not used. [fast] - staticcheck - - typecheck + # It's a set of rules from staticcheck. It's not the same thing as the staticcheck binary. The author of staticcheck doesn't support or approve the use of staticcheck as a library inside golangci-lint. [auto-fix] - unused + # Checks Go code for unused constants, variables, functions and types. # extra linters - asasalint #Â âš™ï¸ Check for pass []any as any in variadic func(...any). bugs 1.47.0 @@ -36,6 +41,7 @@ - errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13. bugs, error v1.32.0 - exhaustive # check exhaustiveness of enum switch statements bugs v1.28.0 # - exhaustruct # Checks if all struct's fields are initialized style, test v1.32.0 + - exptostd # Detects functions from golang.org/x/exp/ that can be replaced by std functions. [auto-fix] - fatcontext # Detects nested contexts in loops. performance 1.58.0 # - forbidigo # Forbids identifiers style v1.34.0 - forcetypeassert # finds forced type assertions style v1.38.0 @@ -62,6 +68,7 @@ - gosec # Inspects source code for security problems bugs v1.0.0 # - gosmopolitan # Report certain i18n/l10n anti-patterns in your Go codebase. bugs v1.53.0 - grouper # Analyze expression groups. style v1.44.0 + - iface # Detect the incorrect use of interfaces, helping developers avoid interface pollution. [auto-fix] - importas # Enforces consistent import aliases style v1.38.0 - inamedparam # Reports interfaces with unnamed method parameters. style v1.55.0 - interfacebloat # checks the number of methods inside an interface. style v1.49.0 @@ -77,6 +84,7 @@ - musttag # âš™ï¸ Enforce field tags in (un)marshaled structs. style, bugs v1.51.0 - nakedret # Finds naked returns in functions greater than a specified function length style v1.19.0 # - nestif # Reports deeply nested if statements complexity v1.25.0 + - nilnesserr # Reports constructs that checks for err != nil, but returns a different nil value error. - nilerr # Finds the code that returns nil even if it checks that the error is not nil. bugs v1.38.0 - nilnil # Checks that there is no simultaneous return of nil error and an invalid value. style v1.43.0 - nlreturn # nlreturn checks for a new line before return and branch statements to increase code clarity style v1.30.0 @@ -91,6 +99,7 @@ - promlinter # Check Prometheus metrics naming via promlint style v1.40.0 - protogetter # Reports direct reads from proto message fields when getters should be used. bugs ✔ v1.55.0 - reassign # âš™ï¸ Checks that package variables are not reassigned. bugs 1.49.0 + # - recvcheck # Checks for receiver type consistency. - revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint. style, metalinter v1.37.0 - rowserrcheck # checks whether Err of rows is checked successfully bugs, sql v1.23.0 - sloglint # Ensure consistent code style when using log/slog. style, format v1.55.0 @@ -99,7 +108,6 @@ - stylecheck # Stylecheck is a replacement for golint style v1.20.0 # - tagalign # âš™ï¸ Check that struct tags are well aligned. style, format ✔ v1.53.0 # - tagliatelle # Checks the struct tags. style v1.40.0 - - tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17 style v1.43.0 - testableexamples # Linter checks if examples are testable (have an expected output). test v1.50.0 - testifylint # Checks usage of github.com/stretchr/testify. test, bugs v1.55.0 - testpackage # linter that makes you use a separate _test package style, test v1.25.0 @@ -107,6 +115,7 @@ - tparallel # tparallel detects inappropriate usage of t.Parallel() method in your Go test codes style, test v1.32.0 - unconvert # Remove unnecessary type conversions style v1.0.0 - unparam # Reports unused function parameters unused v1.9.0 + - usetesting # Reports uses of functions with replacement inside the testing package. [auto-fix] - usestdlibvars # âš™ï¸ A linter that detect the possibility to use variables/constants from the Go standard library. style v1.48.0 # - varnamelen # checks that the length of a variable's name matches its scope style v1.43.0 - wastedassign # wastedassign finds wasted assignment statements. style v1.38.0 diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ GOSWAGGER_VERSION = v0.24.0 GOSWAGGER_BIN = tools/bin/swagger-$(GOSWAGGER_VERSION) -GOLANGCI_LINT_VERSION = v1.61.0 +GOLANGCI_LINT_VERSION = v1.64.6 GOLANGCI_LINT_BIN = tools/bin/golangci-lint-$(GOLANGCI_LINT_VERSION) BASEVERSION = $(shell grep version: swagger.yaml| cut -f2 -d: |xargs) diff --git a/engines/mjml/mjml_test.go b/engines/mjml/mjml_test.go --- a/engines/mjml/mjml_test.go +++ b/engines/mjml/mjml_test.go @@ -35,7 +35,7 @@ ` func BenchmarkDukTapeInit(b *testing.B) { - for i := 0; i < b.N; i++ { + for range b.N { ctx, err := initDukTapeCtx() require.NoError(b, err) ctx.DestroyHeap() @@ -49,7 +49,7 @@ defer ctx.DestroyHeap() b.ResetTimer() - for i := 0; i < b.N; i++ { + for range b.N { _, err := renderDukTape(ctx, mjmlSrc, Options{ Beautify: true, ValidationLevel: ValidationStrict, diff --git a/utils/log-console-writer_test.go b/utils/log-console-writer_test.go --- a/utils/log-console-writer_test.go +++ b/utils/log-console-writer_test.go @@ -282,7 +282,7 @@ w := utils.ConsoleWriter{Out: io.Discard, NoColor: false} - for i := 0; i < b.N; i++ { + for range b.N { _, _ = w.Write(msg) } }