Project structure
The project structure is the foundation of your code that plays a key role in its readability and maintainability. As we discussed in the previous sections, in Go projects, the structure may play a more important role than in other languages, because each exported name generally includes the name of its package. This requires you to have good and descriptive naming for your packages and directories, as well as the right hierarchy of your code.
While the official guidelines define some strong recommendations for naming and coding style, there aren’t that many rules constraining the Go project structure. Each project is unique by nature, and developers are generally free to choose the way they organize the code. However, there are some common practices and specifics of Go package organization that we are going to cover in this section.
Private packages
In Go, all code stored inside a directory called internal
can be imported and used only by packages...