Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.