Skip to content

Instantly share code, notes, and snippets.

@qbig
Created July 29, 2018 03:03
Show Gist options
  • Save qbig/6e38832de6d06b1e67f3c447f07374d6 to your computer and use it in GitHub Desktop.
Save qbig/6e38832de6d06b1e67f3c447f07374d6 to your computer and use it in GitHub Desktop.
Parsing flags with https://github.com/spf13/pflag
package main
import "fmt"
import flag "github.com/spf13/pflag"
func main() {
var f1 *int = flag.Int("f1", 1, "help message for flagname")
var f2 *int = flag.Int("f2", 2, "help message for flagname")
flag.Parse()
fmt.Println(*f1)
fmt.Println(*f2)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment