-
-
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 file to support https://pre-commit.com/ #284
Comments
hi! |
Couldn't you just use:
|
@nexeck the issue with using the hook from https://github.com/dnephin/pre-commit-golang is that it expects golangci-lint to already be installed. One of the main reasons my company are standardizing on pre-commit is that it manages installation and versioning for us, with the version of each linter to use specified in the .pre-commit-config.yaml. This means each of our repositories can have its own version to make it easier to upgrade golangci-lint versions one repo at a time without requiring developers to juggle multiple golangci-lint versions manually on their machines. The way that the pre-commit support works for linters written in Go (like golangci-lint) is that it will install them from the repo where the hook is hosted at the specified version, hence the desire to have a .pre-commit-hooks.yaml in this repository. You could technically use |
Cool, I didn't know that there is a way to not install the binary manually. So, you already know what should be in the pr, and just the cla is a "problem" at the moment? If you could give me any hint, I am happy to create the pr. |
I am getting the following error Command
.pre-commit-hooks.yaml
Error
|
@nexeck yeah, that's right, I've been testing with a
(Note that this isn't the canonical formatting for pre-commit YAML files, your example did that better.) Unfortunately, out of the box I'm not aware of a way to test |
This seems more to be a problem with golangci-lint using go mod. |
@nexeck while it's true that pre-commit hasn't learned to handle repos using go modules (by setting I agree that pre-commit should get updated, but I'd love to get the |
closing because #311 was merged |
We're starting to adopt golangci-lint at my workplace and it's been really great to use so far, thanks for making this useful tool. We're currently standardizing on pre-commit (https://pre-commit.com/) as our main entrypoint to run linters, since we need to support other languages like Python and having a single tool provides a unified experience for all developers. It also has a config file that lets us define the version of each linter to run in a structured format amenable to automated updates, unlike our current approach of ad-hoc lines in Dockerfiles or shell scripts, and ensures developers automatically have the correct version locally as well.
In order to run golangci-lint from pre-commit, there needs to be a
.pre-commit-hooks.yaml
file in the golangci-lint repo. Would it be possible to add one to this repo? I did some testing with a local checkout and it appears that the relevant settings from https://pre-commit.com/#pre-commit-configyaml---hooks would beid
,name
,description
,entry
,language
,types
, andpass_filenames
(that one should be false I think).I would have made a PR myself, but am still going through the legal review process at my workspace to have golangci-lint approved as an upstream (per #267), so I thought I would ask if one of the maintainers could add this file in the meantime. I am happy to review any PRs to do so.
Please include the following information:
golangci-lint --version
(or git commit if you don't use binary distribution)golangci-lint has version 1.11.2 built from f5f7701 on 2018-10-29T14:14:06Z
The text was updated successfully, but these errors were encountered: