This is a comprehensive template for Go projects.
- Install Go
- Add
export PATH=$PATH:$HOME/go/bin
into your shell startup script (e.g../zshenv
). - Install a Go IDE/plugin.
- Install required tools:
- golangci-lint: Bundles many Go linters in one. Integrate it into your IDE.
- sqlc: Converts SQL to Go (use instead of ORM).
- dbmate: Performs database migrations.
- trivy: Dependency scanner for vulnerabilities.
- gotestsum: Formatted test runner.
- k6: For Load Testing.
- oapi-codegen: Generates Go HTTP APIs from OpenAPI 3.0 spec.
- Refer to project-layout for how to organize your Go code.
These are the recommended libraries to choose from.
Library | Description |
---|---|
echo | HTTP API mini-framework |
grpc-go | gRPC API |
go-money | Currency |
zerolog | Logging |
godotenv | Dot Env Config |
is | Testing mini-framework |
gomock | Mocking |
testfixtures | Fixtures |
- Open API Code Gen: oapi-codegen vs. openapi-generator vs. swagger-go?
- E2E API Testing: open-api based E2E tool?
- OpenTelemetry Integration