When we are learning Go, we tend to do it just in a single file thinking of it at a very small scale. But in practice, when we are building production quality stuffs, the first thing we’ve to start doing it is making multiple files, organizing them in folders. So, its the first thing we do, but its the last thing we ever talk about.
The structure of a program is all about – How can you quickly go to the place you need in order to work on the thing you need to work on? Good structures, good file names, good folder names – this stuff all helps with that process.
From Go language, there are some constraints like how you create folders because everything inside a folder is grouped logically as a package. Nested folders don’t really do anything special in Go as they don’t represent nested packages or anything.
One of the way could be to just start with one flat structure, and then later, once there are more code then you try separating those. So, let the structure emerge from the work you are doing, rather than trying to imagine it upfront.