From f04ba4594dece4090d0b18189a2fe14c23367a0b Mon Sep 17 00:00:00 2001 From: Brandon Palm Date: Fri, 16 Jan 2026 13:50:07 -0600 Subject: [PATCH] Upgrade golangci-lint from v1 to v2 Co-Authored-By: Claude Opus 4.5 --- .golangci.yaml | 151 +++++++++++++++++++++++++------------------------ Makefile | 4 +- 2 files changed, 79 insertions(+), 76 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index 65dc0cc..384953d 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -1,3 +1,4 @@ +version: "2" linters: disable-all: true # One can't use disable and disable-all. disable-all is preferred to avoid lint failing when golangci gets updated and linters are added. @@ -42,77 +43,79 @@ linters: #- godot # Allow comments not ending with dot. #- goerr113 # We don't need stack traces in our errors. enable: - - asasalint - - asciicheck - - bidichk - - bodyclose - - decorder - - dupword - - durationcheck - - errcheck - - errchkjson - - errname - - errorlint - - execinquery - - exportloopref - - ginkgolinter - - gocheckcompilerdirectives - - gochecksumtype - - goconst - - gocritic - - gocyclo - - gofmt - - gofumpt - - goheader - - goimports - - gosmopolitan - - govet - - grouper - - importas - - ineffassign - - loggercheck - - maintidx - - makezero - - mirror - - misspell - - musttag - - nestif - - nilerr - - nilnil - - nolintlint - - nosprintfhostport - - paralleltest - - perfsprint - - prealloc - - predeclared - - promlinter - - protogetter - - reassign - - revive - - rowserrcheck - - sloglint - - staticcheck - - stylecheck - - tagalign - - tenv - - testableexamples - - testifylint - - thelper - - tparallel - - typecheck - - unconvert - - unused - - usestdlibvars - - wastedassign - - whitespace -issues: - max-same-issues: 0 - max-issues-per-linter: 0 -linters-settings: - gosec: - excludes: - - G301 # Poor file permissions used when creating a directory. - - G302 # Poor file permissions used with chmod. - - G306 # Poor file permissions used when writing to a new file. - - G601 # Taking address of loop variable - not relevant anymore. - - G602 # Should reports out of bound access but is broken. \ No newline at end of file + - asasalint + - asciicheck + - bidichk + - bodyclose + - copyloopvar + - decorder + - dupword + - durationcheck + - errcheck + - errchkjson + - errname + - errorlint + - ginkgolinter + - gocheckcompilerdirectives + - gochecksumtype + - goconst + - gocritic + - gocyclo + - goheader + - gosmopolitan + - govet + - grouper + - importas + - ineffassign + - loggercheck + - maintidx + - makezero + - mirror + - misspell + - musttag + - nestif + - nilerr + - nilnil + - nolintlint + - nosprintfhostport + - paralleltest + - perfsprint + - prealloc + - predeclared + - promlinter + - protogetter + - reassign + - revive + - rowserrcheck + - sloglint + - staticcheck + - stylecheck + - tagalign + - tenv + - testableexamples + - testifylint + - thelper + - tparallel + - typecheck + - unconvert + - unused + - usestdlibvars + - wastedassign + - whitespace + exclusions: + generated: lax + max-same-issues: 0 + max-issues-per-linter: 0 + settings: + gosec: + excludes: + - G301 # Poor file permissions used when creating a directory. + - G302 # Poor file permissions used with chmod. + - G306 # Poor file permissions used when writing to a new file. + - G601 # Taking address of loop variable - not relevant anymore. + - G602 # Should reports out of bound access but is broken. +formatters: + enable: + - gofmt + - gofumpt + - goimports diff --git a/Makefile b/Makefile index 81e7649..bda24c4 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ OS := $(shell go env GOOS | sed 's/[a-z]/\U&/') ARCH := $(shell go env GOARCH) GORELEASER_VERSION="v1.15.0" -GOLANGCI_LINT_VERSION="v1.55.0" +GOLANGCI_LINT_VERSION="v2.0.2" .PHONY: download-goreleaser download-goreleaser: @@ -25,7 +25,7 @@ download-goreleaser: .PHONY: download-golangci-lint download-golangci-lint: - GOBIN=${BIN_DIR} go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINT_VERSION} + GOBIN=${BIN_DIR} go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@${GOLANGCI_LINT_VERSION} SINGLE_TARGET ?= false