DEV Community

Cover image for Git Hooks for your Golang project
Aarush Goyal
Aarush Goyal

Posted on

10 5

Git Hooks for your Golang project

I have been developing in JavaScript for a while now and one of my favourite tool was husky but when I started developing on golang I really missed the husky tool to manage my git hooks so I created a spin off to husky written in golang.

Check it out

Lets see how you can use it?

Captain Hook

Installation

go install github.com/automation-co/husky@latest
Enter fullscreen mode Exit fullscreen mode

Getting Started

You can initialise husky by $ husky init

Make sure you have git initialised

This will make the .husky folder with the hooks folder and a sample pre-commit hook

You can add hooks using

$ husky add <hook> "
  <your commands for that hook>
"
Enter fullscreen mode Exit fullscreen mode

Example

$ husky add pre-commit "
  go build -v ./... 
  go test -v ./...
"
Enter fullscreen mode Exit fullscreen mode

If you have made any other changes in the hooks you can appply them by using $ husky install

Get Familiar with Git Hooks

Learn more about git hooks from these useful resources:

Other Alternatives

If you feel husky does not fulfill your needs you can also check out:


Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (2)

Collapse
 
hellosagar profile image
Sagar Khurana

op sir

Collapse
 
aarushgoyal profile image
Aarush Goyal

Thank you sir

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay