The foundations of a Go Program
Let's dive into one of the foundations of Go programs. In this lesson, you'll learn to organize your code in a directory structure that will help separate concerns, promote understanding, and support the evolution of the code.
The importance of directory structure
Command-line programs can be tiny or very large. Large programs have a lot of code and are developed over a long time by many different developers. The proper directory structure can contribute a lot to the program’s long-term success. There are several dimensions that benefit from deliberate and well-planned directory structure.
Code organization
The code of every large program should be organized in a way that makes it easy to locate, search, and wrap your head around. Directories with specific roles are a time-tested strategy to achieve this.
Developer collaboration
Developers can collaborate more easily when specific aspects of the program live in distinct directories. Many types of changes will involve specific directories, while other cross-functional changes will involve multiple directories. It is convenient to review changes when files that perform similar functions live in the same directory. Developers can detect omissions ...