Created
August 5, 2014 21:30
-
-
Save jordanorelli/8d59688e6b364eb75e85 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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