0x1d b98b9b2721
Some checks failed
CI / Test (push) Successful in 2s
CI / Build (push) Successful in 2s
CI / Docker Build (push) Successful in 18s
Release / goreleaser (push) Failing after 4s
Release / docker-release (push) Has been skipped
fix: add goreleaser config to specify build main path
2026-01-12 11:22:08 +01:00
2026-01-12 10:17:24 +01:00

Golang Project Template

A production-ready Go project template with Docker builds, CI/CD pipelines, and best practices.

Features

  • Standard Layout: Follows Go project layout standards (cmd, internal).
  • Graceful Shutdown: main.go implements signal handling and context cancellation.
  • Structured Logging: Uses log/slog.
  • Docker: Multi-stage Dockerfile using distroless for secure, small images.
  • CI/CD: GitHub Actions for linting, testing, building, and releasing (with GoReleaser).
  • Tooling: Makefile for common tasks and golangci-lint configuration.

Prerequisites

Getting Started

Build and Run

# Build binary
make build

# Run application
make run

Testing

make test

Linting

make lint

Docker

Build the Docker image:

make docker-build

Run the container:

docker run --rm -p 8080:8080 app:latest

CI/CD

The project includes GitHub Actions workflows:

  • CI (ci.yml): Runs on main and PRs. Validates formatting, linting, tests, and builds.
  • Release (release.yml): Runs on tags (v*). Creates a GitHub Release and pushes the Docker image to GHCR.

Project Structure

  • cmd/app: Main application entry point.
  • internal: Private application code.
  • build: Build artifacts.
  • .github: CI/CD workflows.
Description
Template for golang apps
Readme MIT 64 KiB
1.0.0 Latest
2026-01-15 08:00:06 +01:00
Languages
Go 46%
Dockerfile 36.6%
Makefile 17.4%