Skip to content

pre-commit: golangci-lint uses wrong JSON schema (v2.0), causing config verification errors #6347

@gnought

Description

@gnought

Welcome

  • Yes, I'm using a binary release within 2 latest releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've read the typecheck section of the FAQ.
  • Yes, I've tried with the standalone linter if available (e.g., gocritic, go vet, etc.).
  • I agree to follow this project's Code of Conduct

How did you install golangci-lint?

Other

Description of the problem

I am using pre-commit with golangci-lint pinned to v2.8.0.
However, the golangci-lint-config-verify hook fails with JSON schema validation errors.

Upon investigation, I noticed that the golangci-lint binary installed inside the pre-commit cache reports its version as:

2.0.0-20260107212322-e2e40021c900+dirty

Because of this, golangci-lint fetches the v2.0 JSON schema:

https://golangci-lint.run/jsonschema/golangci.v2.0.jsonschema.json

This schema is incompatible with newer configuration options supported in v2.8.0, which leads to false validation failures.

Steps to Reproduce

.pre-commit-config.yaml:

---
default_stages:
  - pre-commit
  - pre-push

repos:
  - repo: https://github.com/golangci/golangci-lint
    rev: v2.8.0
    hooks:
      - id: golangci-lint-config-verify
      - id: golangci-lint-fmt
      - id: golangci-lint-full

Run:
pre-commit run -a

Actual Result

golangci-lint-config-verify..............................................Failed
- hook id: golangci-lint-config-verify
- exit code: 3

jsonschema: "linters.settings.exhaustruct" does not validate with "/properties/linters/properties/settings/properties/exhaustruct/$ref/additionalProperties":
additional properties 'allow-empty-returns' not allowed

jsonschema: "linters.settings" does not validate with "/properties/linters/properties/settings/additionalProperties":
additional properties 'embeddedstructfieldcheck', 'funcorder', 'godoclint' not allowed

The command is terminated due to an error: the configuration contains invalid elements

Meanwhile, other hooks succeed:

golangci-lint-fmt  Passed
golangci-lint-full Passed

Observed Binary Version in Pre-commit Cache

~/.cache/pre-commit/repom7p7wvum/golangenv-system/bin/golangci-lint --version

golangci-lint has version 2.0.0-20260107212322-e2e40021c900+dirty
built with go1.25.7
from e2e40021c9007020676c93680a36e3ab06c6cd33 (modified: true)
built at 2026-01-07T21:23:22Z

Version of golangci-lint

Details
$ golangci-lint --version
golangci-lint has version 2.0.0-20260107212322-e2e40021c900+dirty
built with go1.25.7
from e2e40021c9007020676c93680a36e3ab06c6cd33 (modified: true)
built at 2026-01-07T21:23:22Z

Configuration

Details
# paste configuration file or CLI flags here

Go environment

Details
$ go version && go env
# paste output here

Verbose output of running

Details
$ golangci-lint cache clean
$ golangci-lint run -v
# paste output here

A minimal reproducible example or link to a public repository

Details
// add your code here

Validation

  • Yes, I've included all information above (version, config, etc.).

Supporter

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions