Skip to content

Instantly share code, notes, and snippets.

@17twenty 17twenty/demo.go
Created Sep 19, 2017

What would you like to do?
Simple demo of setting up the usage preamble
package main
import (
var (
// VERSION is a link time version number specify it with
// `go build -ldflags="-X main.VERSION=0.1"`
VERSION string
configFile = flag.String("c", "config.json", "Use a config file")
func main() {
flag.Usage = func() {
fmt.Println(path.Base(os.Args[0]), "- version", VERSION)
fmt.Println("Hello world")

This comment has been minimized.

Copy link
Owner Author

17twenty commented Sep 19, 2017

Running it....

$ flaggot -h
flaggot - version
  -c string
        Use a config file (default "config.json")
exit status 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.