Closed
Description
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?
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 available- Without any git flags version defaults to
v0.0
when fetching, and hits the 404
I'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:
- Avoid fetching the JSON schema: would it be possible to embed the schema in the binary for validation?
- Drop the hook?
Version of golangci-lint
N/A managed through pre-commit
Configuration
no relevant (any config will trigger this)
Go environment
$ go version && go env
# paste output here
Verbose output of running
$ golangci-lint cache clean
$ golangci-lint run -v
# paste output here
A minimal reproducible example or link to a public repository
reproduction script:
#!/usr/bin/env bash
set -o errexit -o nounset -o pipefail
git init repo
cd repo
cat <<'EOF' > .pre-commit-config.yaml
repos:
- repo: https://github.com/golangci/golangci-lint
rev: v1.64.5
hooks:
- id: golangci-lint-config-verify
EOF
git add .pre-commit-config.yaml
git commit --message 'Add pre-commit'
touch .golangci.yaml
git add .golangci.yaml
pre-commit run --all-files
The relevant output:
golangci-lint-config-verify..............................................Failed
- hook id: golangci-lint-config-verify
- exit code: 3
Failed executing command with error: [.golangci.yaml] 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
Validation
- Yes, I've included all information above (version, config, etc.).
Supporter
- I am a sponsor/backer through GitHub or OpenCollective