go-project-template

Usage

Format

$ make fmt-check
$ make fmt-fix

Lint

$ make lint

Note that staticcheck is installed as a global dependency to avoid it appearing unused in go.mod and therefore getting auto-removed on tidy.

Unit tests

$ make test

Help

View the app’s usage guide

$ make usage
go run main.go -h
NAME:
   My App - Display a friendly greeting

...

Run app

With Go

$ go run main.go
Hello, World!
$ go run main.go --name Gopher
Hello, Gopher!

With make

Run the app through make, using some fixed sample inputs. This is useful for development to check functionality on a few test cases.

$ make run
go run main.go
Hello, World!
go run main.go --name Gopher
Hello, Gopher!

With binary

Install the app globally, as per Quickstart or Installation.

Then run it anywhere by name:

$ go-project-template
Hello, World!

See Deploy for building the app for a release.