Skip to content

freekoder/go-project-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blueprint/Boilerplate for golang service project

A boilerplate for fast golang service development. This project can be useful for golang beginners as a collection of service recipes.

Warning This project is on the development mode now

Targets

  • Create template for rapid golang service development
  • Collect in one place best practices for golang service development
  • Highlight the best tools for beginner golang developers

Project layout

https://github.com/golang-standards/project-layout

Makefile

The Makefile was taken from the article "Quick tip: A time-saving Makefile for your Go projects" by Alex Edwards.

$ make help                                                            
Usage:
  help                print this help message
  tidy                format code and tidy modfile
  audit               run quality control checks
  lint                run linter
  test                run all tests
  test/cover          run all tests and display coverage
  build               build the application
  run                 run the  application
  run/live            run the application with reloading on file changes
  push                push changes to the remote Git repository
  production/deploy   deploy the application to production

This Makefile contains run/live target. It allows to run application with live reloads. run/live implemented on base of Air - Live reload for Go apps. More information can be found at "Using Air with Go to implement live reload".

Unfortunately, this Makefile is missing linting target, based on golangci-lint.

Graceful shutdown

Shutdown of the service is based on the article "Implementing Graceful Shutdown in Go" by Leonidas Vrachnis.

Graceful shutdown uses:

Warning signal.NotifyContext was added only in golang 1.16

Note errgroup use cases:

Web framework

https://echo.labstack.com/

Clean template

https://evrone.com/blog/go-clean-template

Configuration

Logging

REST-API

https://betterprogramming.pub/intro-77f65f73f6d3

Swagger

Profiling

TODO

  • Project structure
  • Makefile
  • Logging
  • Graceful shutdown
  • Graylog
  • Command line args
  • Configuration
  • Profiling
  • Dependency injection
  • Web framework
  • Templates
  • REST-API
  • JWT
  • Swagger
  • Websockets
  • gRPC
  • CI
  • Sentry
  • Docker
  • Clean architecture
  • Linter
  • Testing
  • Database
  • Migrations
  • Redis
  • RabbitMQ/AMQP