golang-cli-template

command module
Version: v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: MIT Imports: 2 Imported by: 0

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 based on the go community default project-layout.

Features

  • goreleaser with deb. and .rpm package releasing
  • golangci-lint for linting and formatting
  • Golang Github Actions Stages (Linting, Testing, Releasing)
  • Gitlab CI Configuration (Linting, Testing, Releasing)
  • tested cobra setup
  • Makefile - with various useful targets (see Makefile Targets)

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

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 2 5 --add                                                
7

$> golang-cli-template 2 5 --multiply
10

Makefile Targets

lint

make lint

format

make fmt

formatcheck

make fmtcheck

build

make build

test

make test

cover

make cover

Documentation

The Go Gopher

There is no documentation for this package.

Source Files

Directories

Path Synopsis
pkg
internal

Jump to

Keyboard shortcuts

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