boilerplate
A golang boilerplate
for CLI apps using viper
, and zap
. Sadly I moved away
from using glog
and flag
on multiple projects.
Caveats / Assumptions
- Golang 1.18 or greater
- GOOS=linux (you can change this in magefile.go)
- GOARCH=amd64 (you can change this in magefile.go)
Quickstart
Clone this repository.
git clone git@github.com:heatxsink/boilerplate.git
Build with mage.
mage build
Run boilerplate with logging to logtostderr
.
./boilerplate -e test
./boilerplate --logtostderr test
Run boilerplate with logging to log/boilerplate.log
.
./boilerplate test
cat log/boilerplate.log
./boilerplate -l /opt/boilerplate/log/boilerplate.log test
./boilerplate --log /opt/boilerplate/log/boilerplate.log test