pre-commit-golang icon indicating copy to clipboard operation
pre-commit-golang copied to clipboard

Basic list of hooks for beginning Go devs

Open richarddewit opened this issue 2 years ago • 2 comments

I'm learning Go and I love pre-commit. This repo has A LOT of hooks, many of them overlap and I'm a bit overwhelmed.

What is a beginner-friendly list of hooks to use for a small project?

Maybe an idea to put a simple example.yaml as a TL;DR in the README

richarddewit avatar Apr 13 '23 14:04 richarddewit

Second this. I started using Go just a few weeks ago so I didn't know about the history of Go's module system with GOPATH and GO111MODULE. Because of that it took me a bit to figure out that since the project was started with a recent version of Go, I wanted the -mod hooks and not the -pkg ones (at least I think).

Maybe an explanation of what it means to set GO111MODULE on or off and a broad claim about the project's age would be warranted? Something like:

In general, projects that use older versions of Go will probably want to use the -pkg suite of hooks, while projects that use newer versions of Go that make use of the module system introduced by Go 1.11 will probably want to use the -mod hooks instead.

I'd make the change myself, but I'm not sure this information is actually correct, and I'd prefer someone who has a deeper knowledge of this to confirm that before giving people incorrect information. I think it's broad enough to give an answer to why you would choose one over the other and explains why the difference even exists in the first place.

aus-hawk avatar Jun 19 '23 02:06 aus-hawk

Hi @richarddewit !

I know its been while since you asked your question - How has your dev journey been going?

Your question is a good one but I feel like it could be better-answered in a larger forumn.

With that, I have re-posted your question on Reddit:

  • https://www.reddit.com/r/golang/comments/15qfxvp/for_those_using_git_hooks_which/

Feel free to hop over there and we can try to learn from the wisdom of the crowds together :)

We may be able to use the discussion to develop some for minimal-but-userful starter yaml.

Thanks for your interest in my project, I look forward further discussion on the matter.

-TW

TekWizely avatar Aug 14 '23 01:08 TekWizely

I'm going to close this as being answered by the linked reddit post (at least a conversation was started). I hope your dev journey is going well. Thanks for taking the time and for using my project!

TekWizely avatar Jul 31 '25 22:07 TekWizely