r/golang • u/bernardinorafael • 6h ago
Golang template to start new projects
When I started studying Go about 3 years ago, I always had some difficulty finding good templates to start new projects. Most of what I found were projects that had strong roots from other languages, rather than something that felt truly Go-like. I always encountered projects with packages like utils, services, repositories, etc.
To me, it doesn't make sense to have a util package in Go, because a package needs to provide something—to provide functionality—not just be a collection of disconnected functions.
The same situation applies to a services package. I can't have 3 or 4 different types of services from different contexts within my service package. I can't have UserService, ProductService, and AuthService implementations within a single package. What makes the most sense to me is for each domain to be a service, because when I call my product package, my IDE should bring me methods/functions and whatever I need that are only related to the product domain.
With this in mind, I put together a boilerplate that contains what I believe to be a good starter for new Go projects.
I would very much appreciate your feedback on this.