Categorygithub.com/disaac/golang-cli-template
modulepackage
0.0.1
Repository: https://github.com/disaac/golang-cli-template.git
Documentation: pkg.go.dev

# README

golang-cli-template

A general purpose project template for golang CLI applications

Test golangci-lint Go Report Card Go Reference codecov

This template serves as a starting point for golang commandline applications it is based on golang projects that I consider high quality and various other useful blog posts that helped me understanding golang better.

Features

Project Layout

  • assets/ => docs, images, etc
  • cmd/ => commandline configurartions (flags, subcommands)
  • pkg/ => packages that are okay to import for other projects
  • internal/ => packages that are only for project internal purposes

How to use this template

bash <(curl -s https://raw.githubusercontent.com/disaac/golang-cli-template/main/install.sh)

Demo Application

$> golang-cli-template
golang-cli project template demo application

Usage:
  golang-cli-template [flags]
  golang-cli-template [command]

Available Commands:
  example     example subcommand which adds or multiplies two given integers
  help        Help about any command
  version     Displays d4sva binary version

Flags:
  -h, --help   help for golang-cli-template

Use "golang-cli-template [command] --help" for more information about a command.
$> golang-cli-template example 2 5 -a
7

$> golang-cli-template example 2 5 -m
10

Makefile Targets

$> make
build                          build golang binary
clean                          clean up environment
cover                          display test coverage
docker-build                   dockerize golang application
fmtcheck                       run gofmt and print detected files
fmt                            format go files
help                           list makefile targets
install                        install golang binary
lint-fix                       fix
lint                           lint go files
pre-commit                     run pre-commit hooks
run                            run the app
test                           run go tests

Contribute

If you find issues in that setup or have some nice features / improvements, I would welcome an issue or a PR :)

# Packages

No description provided by the author
No description provided by the author