go-template

module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2025 License: MIT

README

Go Reference codecov main

Go project template

A comprehensive, production-ready Go project template enforcing best practices. This template provides a solid foundation for building scalable, observable, and maintainable Go services.

Getting started

  1. Fork this repo
  2. Create project repo using the fork as a template
  3. Clone the project repo and run make -f rename.mk
  4. Run make all to verify that everything works
  5. Create a PR see how the github workflow gets triggered

Project layout

The template is structured to provide a solid foundation while allowing easy customization for your specific project needs.

Go files
  • ./api/ - rest api layer generated from openapi.yaml
  • ./app/ - business logic that maps to rest endpoints inside api
  • ./applicationtest/ - application/integration tests (tests executed against application binary)
  • ./cmd/demo/ - main package for application, automatically renamed based on repo name
  • ./server/ - configures http.Server with api handler
  • ./store/ - database layer with migration support
  • ./store/migrations/ - database schema migration files
Non Go files
  • ./.github/ - configuration files for github actions
  • ./.golanci.yaml - configuration golangci-linter
  • ./.ogen.yaml - configuration ogen api generator
  • ./server/openapi.yaml - api specification
  • ./server/swaggerui - swagger ui files
  • ./docker-compose.yaml - configuration for services used in test
  • ./Dockerfile - image definition for Go binaries
  • ./Makefile - build tooling configuration
  • ./ci.mk - build tooling configuration for CI only targets
  • ./rename.mk - script to run rename after cloning initial template
  • ./telemetry/ - configuration for otel related tools
  • ./target/ - container for build and test artifacts

Libraries

Tools from OS

Tools from Go (using go tool)

  • golangci-lint - Code quality and style enforcement
  • gotestsum - Test output formatter
  • ogen - OpenAPI code generation with observability and validation

CI

Directories

Path Synopsis
cmd
demo command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL