-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add .pre-commit-hooks.yaml #311
Conversation
This file will allow using golangci-lint with https://pre-commit.com.
cc @diegs |
entry: golangci-lint run | ||
types: [go] | ||
language: golang | ||
pass_filenames: false |
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.
I think should support passing filenames, right? Otherwise this won't have the ability to do somewhat incremental diffs.
Separately, it would be nice to pass the sha and only do incremental diffs on a per-commit basis. I know golangci-lint supports this, but I don't think pre-commit does.
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.
While that's true, golangci-lint AFAIK expects go package directories, not filenames, and I'm not sure whether a wrapper script here in golangci-lint, or a converter in pre-commit (since other Go tools are likely to use the same convention) is better.
pre-commit can be smart about only checking staged files during an actual pre-commit hook, but I haven't thought about how to integrate that with golangci-lint; fixing the pass_filenames
thing would be a good first step there.
I'd like to get this in as a basic implementation first, and then refine it to get the improved performance/benefits of incremental linting afterwards since that will require a bit of design work.
@aneeshusa LGTM, though I have no access to this repo to grant any real approvals :) |
thank you for the pull request! |
This file will allow using golangci-lint with https://pre-commit.com.
Thank you for the pull request!
Please make sure you didn't directly change
README.md
: it should be changed only by changingREADME.tmpl.md
and runningmake readme
.