Skip to content
Simple boilerplate to create CLI applications with Go
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Go Simple CLI Boilerplate

Simple boilerplate to create CLI applications with Go

How to use

With Docker

  • Clone this repo and enter it

  • Run docker build -t "mytag" .

  • Run docker run -it --rm mytag hello

Without Docker

  • Clone this repo and enter it

  • Run go get ./...

  • Run go run app.go hello or build the application with go build and execute the binary like: ./app hello


  • The cmd module is where you will create your commands. Create a file for each command following the example of cmd/hello.go

  • The flag_variables.go is used to declare variables that will receive the flags values, I did this to reuse the variables instead of creating new ones for each command.

    • Example: If have two commands with the variable var source string. You can declare the source in command A file and reuse it in command B file but it will get messy to know where the variables are declared. You can create a new variable but probably it will have a name almost equal to source and it's redundant because they're for the same thing.
  • The core module is where you put things that's common and/or can be used to all your application like the application configuration

    • The config.go offers basic methods to work with the application configuration, you can create your own methods here
    • The init.go is where you put things that you will expose to other packages like the AppConfiguration


Bug reports and pull requests are welcome on GitHub at This project is intended to be a safe, welcoming space for collaboration.


This project is available as open source under the terms of the MIT License.

You can’t perform that action at this time.