I'm currently learning Go, and I have learned that Go suggests (expects? enforces?) that you use a specific folder layout for your workspace:
- my-go-workspace
- src
- bin
- pkg
I perfectly understand the reasoning for this, and I definitely see its advantages. So, basically, I think it's a good thing to have a structure like this.
The only thing I don't like about this, is that it is a completely different structure from my other projects. E.g., for my Node.js projects there is a folder such as this:
- projects
- moduleA
- moduleB
- ...
Now if I want to keep Node.js modules and Go packages side-by-side, in a unified folder structure I either have to use Go's way for Node.js as well (which feels wrong), or vice-versa (which feels wrong either).
I guess it's probably a dumb idea, and I should simply stick with Go's suggestion and live with two different ways of organizing my code (hey, it's different languages, why should the folder layout be the same?), but somehow this does not feel clean to me.
I know that this a highly subjective and personal, but my question is, if there are any practices out there on how to solve this? Or should I just live with it?
A more simple idea:
golos-projects
L node-project-a
L what
L ever
L yolo
L node-project-b
L we
L love
L npm
L go-project-a
L src
L pkg
L bin
L go-project-b
L src
L pkg
L bin
And just set your GOPATH
to e.g. golos-projects/go-project-b
and hack away. When you want to switch to another project just change your GOPATH
to the new project's folder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With