3 ms·
Code organization question: is this a common convention in Go, to nest the main package in a subdirectory and put all of the 'modules' in different files but wi
by pandeiro 13y ago
Code organization question: is this a common convention in Go, to nest the main package in a subdirectory and put all of the 'modules' in different files but with the same package name?
(I'm more used to the Clojure namespace/filesystem symmetry, so this is somewhat new to me. I like the more shallow project tree but it's not immediately apparent where things are defined.)
- redbad 13y agoIn a package, main or otherwise, files are purely for programmer convenience. They define import scope but are otherwise transparent to the toolchain.
- sarnowski 13y agoYou have to have your main() in package "main" and all your files in one directory have to be in the same package. So when you want a main() and your logic in a "real" package, your have to seperate them.