
Go boilerplate web server with all Cogo specific best practices
Go boilerplate is a straightforward starter pack designed for building web servers while adhering to Cogo's best practices. It is tailored to enhance interoperability, understandability, and discoverability across all projects, making it an excellent choice for both beginners and experienced Go developers. To kick off your journey, it’s advisable to explore "Go By Example" followed by "Effective Go" after gaining initial familiarity with the Go language and its modules.
The structure of the Go boilerplate includes distinct directories for commands, packages, internal codes, metrics, web functionalities, testing, and automated workflows through GitHub Actions, ensuring a well-organized codebase for optimal development and maintenance.
cmd Directory: This directory contains entry points into your application, organizing each binary into its own subdirectory alongside a main.go file for clarity.
pkg Directory: The heart of your application, where most of the source code resides. It allows for easy access from within your repository or other packages.
internal Directory: Enforces encapsulation by housing source code that shouldn’t be imported by other Go modules, enhancing the integrity of your application.
Metrics and pprof: Leverages Prometheus for application metrics, ensuring you can track performance effectively, while pprof assists in gathering runtime data for optimization.
Web Functionality: Utilizes the powerful github.com/gorilla/mux router for handling HTTP requests, providing a robust foundation for managing web traffic.
Testing Framework: Implements a straightforward testing structure using files named *_test.go which integrate smoothly with the Go testing tool, ensuring your code's reliability with the help of stretchr/testify for assertions.
GitHub Actions Integration: Automates the compilation and testing processes with GitHub Actions, facilitating continuous integration and delivery workflows as defined in the .github/workflows/ YAML files.
This Go boilerplate effectively streamlines the development process, making it accessible and efficient for projects of varying scopes.
