Skip to content

Conversation

davidjb
Copy link
Contributor

@davidjb davidjb commented Jan 30, 2023

Fixes #1245
by passing filenames from pre-commit to golangci-lint run (which supports this since that issue was originally opened) and when used with --new-from-rev HEAD allows for partial commit support.

Fixes golangci#1245 by passing filenames from pre-commit to `golangci-lint run` and when used with `--new-from-rev HEAD` allows for partial commit support.
@boring-cyborg
Copy link

boring-cyborg bot commented Jan 30, 2023

Hey, thank you for opening your first Pull Request !

@CLAassistant
Copy link

CLAassistant commented Jan 30, 2023

CLA assistant check
All committers have signed the CLA.

@ldez ldez changed the title fix: check only changed files in pre-commit hook feat: check only changed files in pre-commit hook Jan 30, 2023
@ldez ldez added the enhancement New feature or improvement label Mar 6, 2023
Copy link
Member

@ldez ldez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ldez ldez merged commit 985efcc into golangci:master Mar 6, 2023
@gnuletik
Copy link
Contributor

gnuletik commented Mar 6, 2023

When copying this config locally and running pre-commit run --all-files, I get the following errors from linters:

ERRO [linters_context] typechecking error: named files must all be in one directory; have some/pkg and another/pkg
ERRO [linters_context] typechecking error: named files must all be in one directory; have my/pkg and some/other/pkg

And

failed executing command with error parallel golangci-lint is running

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: pre-commit enhancement New feature or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pre-commit hook runs on all files instead of just changed files in the repo
4 participants