-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat: add verify command #4527
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
feat: add verify command #4527
Conversation
335820d
to
38b7222
Compare
@Antonboom do you have an opinion about this one? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Antonboom do you have an opinion about this one?
🙏 I try to review as soon as possible
Let's consider the feature with validator in golangci website, like
Before doing that the website should be changed.
Sorry, I never know if anyone has seen a PR or not, so I friendly ping, I don't want to be too pushy. |
This reverts commit 6fa3e3a.
This PR adds a new command
config verify
.This command allows to verify a configuration file against a JSON Schema.
The JSON schema is obtained based on this approach:
https://golangci-lint.run/jsonschema/golangci.v<major>.<minor>.jsonschema.json
https://raw.githubusercontent.com/golangci/golangci-lint/<commit>/jsonschema/golangci.next.jsonschema.json
The make target
website_copy_jsonschema
has been modified to createhttps://golangci-lint.run/jsonschema/golangci.v<major>.<minor>.jsonschema.json
.Fixes #2645
Why we will not use JSON Schema to validate
.golangci.reference.yml
or.golangci.next.reference.yml
?.golangci.reference.yml
and.golangci.next.reference.yml
are invalid by nature: they contain the exhaustive list of options but those options can be incompatible.Same thing for the configuration loading:
How many versions of the JSON schema we will support?
The build of
golangci-lint
using a specific official commit will use the schema related to its commit (https://raw.githubusercontent.com/golangci/golangci-lint/<commit>/jsonschema/golangci.next.jsonschema.json
).For the "real" versions, for now, we will support only the current stable version.
The system has been made to support more versions if needed: if a schema is inside the directory
jsonschema/
it will be published as the other schema.If we want to follow this way, I think we should limit the support to the 2 latest stable versions.
Why we don't embed the JSON Schema?
The usage of remote JSON schema allows us to fix the schema without releasing golangci-lint.
I think IDEs or text editors, that use JSON schema, will be always better than a command line to quickly identify syntax errors.
It is not worth to increase the binary size only for a niche.