Skip to content

Migrate golangci-lint to v2 (v1 is EOL and cannot parse Go 1.27) #1164

Description

@batmac

The problem

golangci-lint v1 cannot analyze this repo any more. Running the current pinned line against a Go 1.27 toolchain fails to load packages at all:

pkg/log/log.go:9:2: could not import sync/atomic (-: could not load export data:
internal error in importing "sync/atomic" (cannot decode "sync/atomic",
export data version 4 is greater than maximum supported version 2)) (typecheck)

Every subsequent typecheck error is an artifact of that failure, not real. The linter appears to run (in make janitor and the pre-commit hook) while effectively checking nothing — a silent quality gap.

golangci-lint v1 is end-of-life; current upstream is v2.13.1.

Why it is not a one-line bump

v2 changed the configuration schema: .golangci.yml needs a version: "2" key, linters.enable moved, and run.build-tags relocated. Upstream ships a migration command:

golangci-lint migrate

Bundle into the same change: 6 dead linters

These are enabled in .golangci.yml but inactive or removed — three of them log "fully inactivated: it will not produce any reports":

enabled linter status replacement
execinquery archived upstream, inactivated
exportloopref obsolete since Go 1.22 loopvar copyloopvar
tenv duplicate feature usetesting
rowserrcheck, sqlclosecheck, wastedassign deprecated in v1 (n/a — no SQL in this repo)

Expect real findings

Because linting has effectively been off, the migration will surface a batch of genuine issues. That is the point, but it means this should be reviewed rather than automerged.

Also in scope

  • The pre-commit hook (dnephin/pre-commit-golang, .pre-commit-config.yaml) invokes the same config and is skipped on pre-commit.ci — re-check it after the migration
  • make janitor had --go=1.19 hardcoded (removed in the Makefile cleanup PR); confirm v2 picks the language version up from go.mod

🤖 Issue drafted with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions