golang-cli

module
v0.0.0-...-a929ff9 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2020 License: MIT

README

Go CLI - Template

Go Report Card

This is a template repository to create CLI using golang. It creates a powerful cli using Cobra and Viper as main packages.

Setup

Create your own .config.yaml file to configure the CLI.

To set up the git hooks run the following command.

cp ./scripts/pre-commit-hook.sh .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit

Running Locally

go run ./cmd/golang-cli/main.go help

Dependency Management

This package uses go modules. Whenever you run go build or go test all dependencies will be downloaded automatically. See go.mod and go.sum to see all modules used by this package.

Configuration

Runtime

Many settings are set throught the .config.yaml file and read using the Viper package to set the configuration of the project and to retrieve the configuration values.

An example of the configuration file can be found at configs/.config.example.yaml.

Project Structure

The project structure used follows the project layout defined in Golang Standards - Project Layout, which used a lot of definitions found in the web and compiled an unified layout.

Directories

Path Synopsis
cmd
internal
cmd

Jump to

Keyboard shortcuts

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