gostarter

module
v0.0.0-...-ed7e9db Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2020 License: MIT

README

gostarter

Boilerplate For Golang Application/Service Project

Setting Up
  • Replace All Occurrences of anjuspace/gostarter with your username repository name
  • Replace All Occurrences of app with your desired image name
Adding New Libraries/Dependencies
go mod vendor

Go Modules

This assumes the use of go modules (which will be the default for all Go builds as of Go 1.13) and vendoring (which reasonable minds might disagree about). You will need to run go mod vendor to create a vendor directory when you have dependencies.

Building

Run make or make build to compile your app. This will use a Docker image to build your app, with the current directory volume-mounted into place. This will store incremental state for the fastest possible build. Run make all-build to build for all architectures.

Run make container to build the container image. It will calculate the image tag based on the most recent git tag, and whether the repo is "dirty" since that tag (see make version). Run make all-container to build containers for all supported architectures.

Run make push to push the container image to REGISTRY. Run make all-push to push the container images for all architectures.

Run make clean to clean up.

Using GitHub Registry

Create and Push:

docker login docker.pkg.github.com -u <USERNAME> -p <GITHUB_TOKEN>
docker build -t  docker.pkg.github.com/anjuspace/gostarter/app:latest .
# make container
docker push docker.pkg.github.com/anjuspace/gostarter/app:latest
# make push

Pull and Run:

docker pull docker.pkg.github.com/anjuspace/gostarter/app:latest
docker run docker.pkg.github.com/anjuspace/gostarter/app:latest

Directories

Path Synopsis
cmd
app command
internal
platform/log
Package log configures a new logger for an application.
Package log configures a new logger for an application.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL