goignore icon indicating copy to clipboard operation
goignore copied to clipboard

[Proposal] Improvement on the layout of the project

Open noornee opened this issue 2 years ago • 2 comments

hii @hacktivist123 writing all the logic in a single file (main.go) is fine but as the project keeps expanding, it's gonna be a mess to keep tabs of all that's happening(cluttered). I wanna suggest a change to the layout of this project and i would totally understand if you do not wish to change its current layout. :)

late yesterday, i was looking for a project layout and--

a little backstory the reason why i did this was cause when i first came across this project and i was reading through the detectLanguage logic, i had a minor brain fart for almost 10 seconds because for the love of God, i couldn't see where the extensions variable was coming from. i was looking at the function parameters and i couldn't find extension as a parameter there. the fart left and then it dawned on me that i could just go to the function definition to know where its coming from (i have a keybinding for that) okay i honestly dunno why I'm saying this cos it makes absolutely no sense but this was what made me start thinking of a way to improve the layout...

then i remembered that spf13/cobra has a CLI tool that generates some kind of structure

cobra-cli is a command line program to generate cobra applications and command files. It will bootstrap your application scaffolding to rapidly develop a Cobra-based application. It is the easiest way to incorporate Cobra into your application.

i installed it on my machine and tried generating a cobra application and it looked like something we could consider imitating.

i modified the structure a bit and came up with this

what are your thoughts on this?

goignore_gimp_screenshot

ignore the template files directory and some other missing files, i deleted them so it wouldnt take up all the space for the screenshots

noornee avatar Aug 08 '23 00:08 noornee

you have a good point, can you send me a link to the tool?

hacktivist123 avatar Aug 15 '23 10:08 hacktivist123

you have a good point, can you send me a link to the tool?

this is it https://github.com/spf13/cobra#usage

noornee avatar Aug 16 '23 06:08 noornee