It is mainly made for small cloud projects. Contains simple graceful shutdown, healthchecks, config system and a default library code.
How to use this template
Use the repo as template
Edit go.mod file - change the name of the service (like username/my_service)
Configure the CI pipeline actions in the Makefile at line 60 in the release action (Optional)
Code
Deploy
Development opeartions
This is a section which suggests useful tools for devlopment and standatises the workflow.
make to run application
make build or make dist to create a binary distribution of your service. build creates binary and dist creates a binary and packs it into a zip folder
make docker to create a docker container image using the docker file
make dock to run your docker container
make clean to remove dist and build artifacts
make major/minor/patch to bump the version and start a CI pipeline
CI pipeline configuration actions
bump - changes the software version in the Makefile. Don't change it, usually it would not do anything bad. If release is called iw would do nothing. If major/minor/patch called it changes the version.
build - builds the binary of your software. It uses the build matrix defined by 2 vars: TARGET_OS and TARGET_ARCH. By default windows and darwin OS, as well as arm64, i386 and arm architectures are commented. Uncomment to enable them.
dist - runs buildand packs every binary in an archive with corresponding name
git_full - runs git_commit and git_tag
git_commit - adds Makefile changes and commits the code with the "Version ${version}" message, then pushes to default remote
git_tag - adds the annotated tag with the version and pushes to default remote
gh_release - uses Github's CLI tool to create Github Releases and pushes the current version with results of dist action
docker - builds a docker image tagged by latest and by the last version
docker_push - if DOCKER_PREFIX is present, pushes the latest docker image with both version and latest tag to the remote