Frameworks
In Chapter 2, we covered the topic of the Go project structure, as well as some common patterns of organizing your Go code. The code organization principles that we described are generally based on conventions – written agreements or statements that define specific rules for naming and placing Go files. Some of the conventions that we followed were proposed by the authors of the Go language, while others are commonly used and proposed by authors of various Go libraries.
While conventions play an important role in establishing the common principles of organizing Go code, there are other ways of enforcing specific code structures. One such way is using frameworks, which we are going to cover in this section.
Generally speaking, frameworks are tools that establish a structure for various components of your code. Let’s take the following code snippet as an example:
package main
import (
"fmt"
"...