Skip to content

Instantly share code, notes, and snippets.

@jordanorelli
Created August 5, 2014 21:30
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jordanorelli/8d59688e6b364eb75e85 to your computer and use it in GitHub Desktop.
Save jordanorelli/8d59688e6b364eb75e85 to your computer and use it in GitHub Desktop.
package main
import (
"flag"
"fmt"
)
var options struct {
s string
i int
f float64
}
func main() {
flag.Parse()
fmt.Println(options)
}
func init() {
flag.StringVar(&options.s, "string", "", "a string")
flag.IntVar(&options.i, "int", 0, "an int")
flag.Float64Var(&options.f, "float", 0, "a float")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment