-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
golangci-lint-config-verify
pre-commit hook fails with 404
#5478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hello, The problem is the way to install golangci-lint.
|
digging deeper: looks like something changed between Go 1.23 and Go 1.24. The build process for $ git init repo
$ cd repo
$ git remote add origin https://github.com/golangci/golangci-lint.git
$ git fetch origin v1.64.5 --depth 1
$ git checkout FETCH_HEAD
$ go install ./... testing the $ go1.24.0 install ./...
$ golangci-lint version
golangci-lint has version v0.0.0-20250213211019-0a603e49e5e9 built with go1.24.0 from (0a603e49e5e9870f5f9f2035bcbe42cd9620a9d5, modified: false, mod sum: "") on 2025-02-13T21:10:19Z
$ golangci-lint config verify
Failed executing command with error: [.golangci.yml] validate: compile schema: failing loading "https://golangci-lint.run/jsonschema/golangci.v0.0.jsonschema.json": https://golangci-lint.run/jsonschema/golangci.v0.0.jsonschema.json returned status code 404 vs Go 1.23: $ go1.23.0 install ./...
$ golangci-lint version
golangci-lint has version (devel) built with go1.23.0 from (0a603e49e5e9870f5f9f2035bcbe42cd9620a9d5, modified: false, mod sum: "") on 2025-02-13T21:10:19Z
$ golangci-lint config verify
# runs successfully |
We will not embed the JSON Schema, I provided an explanation here: #4527 |
I think I know where the root of the new behavior is. |
But I want to be clear that your approach based on shallow clone doesn't work even with go1.23. Because the version will be |
If that's the case, then maybe the hook isn't viable? I can't imagine |
I don't use pre-commit but for me, pre-commit doesn't imply compiling a binary. |
You can use our script to install the binaries: https://golangci-lint.run/welcome/install/#other-ci |
For the explanation of the new behavior:
|
For clarity: |
I need to check something, give me a few minutes. |
The discussion is happening on Slack |
Welcome
typecheck
section of the FAQ.How did you install golangci-lint?
I don't know
Description of the problem
This hook will try to fetch https://golangci-lint.run/jsonschema/golangci.v0.0.jsonschema.json and fail (see reproduction below). I think the reason it tries to fetch this is:
pre-commit
will do a shallow clone beforego install ./...
and so not have git tags availablev0.0
when fetching, and hits the 404I'm a bit confused how this worked before: even dropping the
rev
in the pre-commit hook to an earlier version, that I knew to work, it fails with the same error. Maybe https://golangci-lint.run/jsonschema/golangci.v0.0.jsonschema.json did resolve at some point? Though I can't think of a sensible value for it: if you use the latest value, then older clients could break.Ideas for fixes:
Version of golangci-lint
N/A managed through
pre-commit
Configuration
no relevant (any config will trigger this)
Go environment
Verbose output of running
A minimal reproducible example or link to a public repository
reproduction script:
The relevant output:
Validation
Supporter
The text was updated successfully, but these errors were encountered: