by pythonist on 11/3/19, 3:22 PM with 9 comments
by 0xFACEFEED on 11/3/19, 7:44 PM
The golang-standards/project-layout repo is the inevitable outcome. An over-engineered land grab (let's call it what it is). But 11k stars is a decent indicator of Go programmers wanting some kind of authoritative standard so they don't need to re-organize their now-small but tomorrow-large projects over and over.
A recent issue that parallels this one is package management. So many monstrosities came out of that until go modules was formalized :P
by enneff on 11/3/19, 8:03 PM
IMO,
don’t use a pkg directory. It only makes your import paths more unwieldy.
Don’t use internal unless you have a package that is an awkward implementation detail that must be shared between packages for expedience. Usually this can be factored away with some effort but sometimes it’s not worth it.
Do use cmd directories. They make it clear what “go install” will do.
But otherwise really just pick any approach and move on with your life.
by dmlittle on 11/3/19, 7:55 PM
This is also one of the reasons why some other programming languages might have adopted the standard of src/ or lib/.
by blaisio on 11/4/19, 12:07 AM
... How? They just don't tell you that files have to be under a certain directory. It's beyond me how that upsets people.
I think this is just people looking for something to argue about. The go team can't standardize everything.
by Insanity on 11/3/19, 7:35 PM
Anyway, OT: Even though there might not be an "official" standard, there is indeed a community standard.
If I explore other projects I hope to see some common structures reflected there, which makes it easier to browse the code.
by meddlepal on 11/4/19, 12:34 AM
by awinter-py on 11/3/19, 10:45 PM
just import file paths like everyone else -- it's simpler and not obviously worse