#Project structure
37 messages · Page 1 of 1 (latest)
aspects of it
dont just make all of those folders just for the sake of following the layout
Can you please link me the default layout recommended by the GoLang team?
Are these packages or the project definition from the outside?
wdym?
like does each folder of what is present in the repo contain go files?
Standard Package Layout, https://medium.com/@benbjohnson/standard-package-layout-7cdbc8391fc1 - Skippy
It’s just way too much stuff for all of my projects. I don’t follow it at all
Make modules when they make sense. Use them to group code. Don’t go crazy
no i wouldnt, there's no compelling reason for me to do that
i do whatever make the most sense for the specific project i am doing, on a case by case basis
(though there's only a few "formats" i use to structure it)
start by putting all your files into one single directory and go from there
if you have both a main prog and a lib, put the main inside cmd/name dir
if you have sub libs, put them inside their own folder
what
it's for executable's name
otherwise if someone go install it, it would be named cmd
(yes there's ways around it, like not having cmd prefix, or having exec in root instead, but these are situational)
you dont really need the cmd folder unless u want multiple executables
name is a dir, its the name of the app
incorrect please dont spread misinformation
here is an example https://github.com/itchyny/gojq
What do you mean?
yes there's other ways you do not need "cmd" you can just do
go.mod
foo/ <lib
fooer/ <cmd
foobar/ <cmd2
cmd is just what people did
i do not express support or am against it, i am just mentioning it
You don’t even need folders at all
You can have everything in the root directory
we can also have multiple execs without a cmd dir, in fact you can do wahtever you want
Yes, and that corroborates to the fact that what ftqo said is not a misinformation at all
werent we discussing conventions?
Im off this discussion, good luck guys
op, as you can see, theres lots of disagreement with that repo, and thats fine lol
I dont think this is a good practice, is it?
It depends on what your code is doing
But most times, yes, it is a bad practice
it is not a bad practice, it is the default
but once your project gets bigger you have to split it