rfdez / go-api-template

Go API Template with linter, testing and docker configured.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[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

About

Go API Template with linter, testing and docker configured.

License:MIT License


Languages

Language:Go 89.4%Language:Dockerfile 10.6%