Skip to content
/ go-api-template Public template

Go API Template with linter, testing and docker configured.

License

Notifications You must be signed in to change notification settings

rfdez/go-api-template

Repository files navigation

[WIP] Go API Template

In this repository you will find a template for creating a Go backend project. It includes the entrypoint of the application, testing, linter and docker already configured.

📄 Features

  • Go as programming language
  • Gin as web framework
  • Testify. A toolkit with common assertions and mocks that plays nicely with the standard library
    • With Mockery for generating mocks
    • With httptest native package for testing HTTP handlers
  • Golangci-lint as linter and formatter
  • Docker as containerization tool
  • Github Actions for CI (Continuous Integration)
  • Taskfile for task automation

🚀 Getting Started

# Install dependencies
task deps

# Run the application
task run

# Build the application
task build

# Run the application with the binary
task start

🐳 Docker

# Build the image
docker build -t <owner>/go-api-template:<tag> .

# Run the container
docker run --rm -p 8080:8080 <owner>/go-api-template:<tag>

🧪 Testing

# Run tests
task test

💅 Linting

# Run linter (if you have golangci-lint installed)
task lint

# Run linter (with docker)
task lint:docker