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
- 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
https://github.com/golang-standards/project-layout
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.
Shutdown of the service is based on the article "Implementing Graceful Shutdown in Go" by Leonidas Vrachnis.
Graceful shutdown uses:
- signal.NotifyContext() from os/signal package
- errgroup.WithContext() from golang.org/x/sync/errgroup package
Warning signal.NotifyContext was added only in golang 1.16
Note errgroup use cases:
https://evrone.com/blog/go-clean-template
- https://github.com/ilyakaznacheev/cleanenv
- https://dev.to/ilyakaznacheev/clean-configuration-management-in-golang-1c89
https://betterprogramming.pub/intro-77f65f73f6d3
- 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