rycus86 / githooks

Githooks: per-repo and global Git hooks with version control
MIT License
380 stars 19 forks source link

Rewritting in Go #126

Closed gabyx closed 3 years ago

gabyx commented 3 years ago

I am just leaving this for brainstorming: I am really thinking (since implementing changes in Shell is so much pain in the ass, not even talking about global variables, IFS= etc...) that this project, as it its well testet and setup, would profit from a Go implementation which reduces code size largely. I am not sure if its worth taking on this endeavour, but I could dive into Go which I anyway wanted to do once in a while.

If there is support from others to do this, maybe why not give it a shot :-), takes probably some time. I have just seen as a contributor of several PRs here, that it gets more and more messy and also cumbersome in Shell. If

The progress of porting this application could be like this:

Files such as

rycus86 commented 3 years ago

I'm not super keen on the rewrite tbh, but happy to assist you if you want to try, then we can see how it's working out. You could also try to attack specific functions one-by-one, rather than replacing the whole base template runner in one go. Instead you could delegate execution to the new Go binary from the base template for things that are ready.

Having said this, I'm not super sure if the rewrite is worth the effort, so curious to understand more about the pain you're feeling with Shell?

gabyx commented 3 years ago

Jeah, if I would start a rewrite (more also out of curiosity) I should start only with good to tackle portions, like base-temlate.sh and test the tests which already directly use it :).

My pain:

gabyx commented 3 years ago

As I am curious about go anyway, I make this project my test ground for proper go code :see_no_evil:. https://github.com/gabyx/githooks/tree/feature/go-refactoring

rycus86 commented 3 years ago

As I am curious about go anyway, I make this project my test ground for proper go code πŸ™ˆ. https://github.com/gabyx/githooks/tree/feature/go-refactoring

Awesome! Looking forward to seeing what you get up to! I can try to help if you need some help.

Also wanted to say that I have a few Go projects with Travis integration that could maybe help to get some ideas from:

gabyx commented 3 years ago

Sounds awesome, I already kind of love Go, some stuff is nicer in bash of course, but I think Go is the way to go. See the latest, the code gets really clean :-) Currently triying to make some progress with runner.go... :-)

gabyx commented 3 years ago

image

gabyx commented 3 years ago

Coverage ist up, juheiii: https://coveralls.io/jobs/74453688

Not so bad with 78% so far. Note: Its only what code was executed, not really what was tested...

gabyx commented 3 years ago

@rycus86: Checkout https://github.com/gabyx/githooks#dialog-tool :partying_face: