-
Notifications
You must be signed in to change notification settings - Fork 166
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
change language of .pre-commit-hooks.yaml to golang #301
Conversation
Actually, this does not work straight away, as @adamchainz noted in #297 . I found a solution on my fork that works: dokempf@691f4ee |
What is your environment? It works for me #297 (comment). Can your try: # ...
- repo: https://github.com/Freed-Wu/actionlint
rev: v1.6.25
hooks:
- id: actionlint |
Your |
What is your enviroment? This is mine: $ go version
go version go1.20.4 linux/amd64
$ uname -r
6.3.2-arch1-1 |
I don't have go installed - and that is exactly the point of this change. |
If I uninstalled go, I'll get
Can you install go to validate again? |
I'm not a user of pre-commit. So I'm not familiar with the tool. Considering compatibility, is it safe to replace |
One more point. pre-commit seems to install the binary using |
@rhysd The idea with pre-commit is that all hooks are installed into isolated environments managed by pre-commit. For golang, this means that it will use an isolated, separate |
@dokempf Thank you for your explanation. It clarifies my several concerns. My remaining concern is:
Isn't it a breaking change for those who don't install Go toolchain and using system-installed actionlint with pre-commit? Though actionlint is written in Go, it is not a tool for Go. Users can use package managers such as Homebrew or pre-built binaries without building it from source. So I think pre-commit config should not be tied with Go by default. However, I also understand the
It makes sense. Adding this constraint means a breaking change for users who are already using |
I guess one could argue how breaking the change is. I would not consider the requirement to update pre-commit to be too breaking. The fact that your existing local installation of |
Fixed. minimum_pre_commit_version: 3.0.0 |
@dokempf I may be too conservative. Since I'm not a user of pre-commit, I'd like to prioritize actual users' opinions. So I think changing the In addition, I think it is good to add the classic @Freed-Wu @dokempf Current configuration clones the HEAD of main branch, am I correct? If so, I think it is safer to fix the revision cloned by pre-commit to the latest tag name (currently it's v1.6.24). Is it possible? Since v1.6.24 doesn't include the fix for #297, it is not available. But I'd like to know how to do it for the next release (probably 1.6.25). |
I understood that the revision is in |
Thanks for the fast merge @rhysd Be aware that in order for this to be fully usable from within pre-commit, a new release of actionlint is required (mutable references like branches are not properly supported in pre-commit). |
OK, I'll make a new release 1.6.25 tomorrow after adding the legacy |
v1.6.25 was released. |
I have just tried the new golang hook out on my client's project and it works well. It's 10x faster than the Docker one - taking a 0.91s runtime down to 0.09s. Thank you very much! 🤘 |
Refer https://github.com/scop/pre-commit-shfmt/blob/main/.pre-commit-hooks.yaml