Created
August 23, 2016 21:55
-
-
Save bernerdschaefer/c29c55d52b55299afbe22a214e34e282 to your computer and use it in GitHub Desktop.
This file contains 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 | |
type Options struct { | |
Input string | |
Output string | |
Switch bool | |
} | |
func parseFlags(options *Options) { | |
flag.StringVar(&options.Input, "", "input file") | |
flag.StringVar(&options.Output, "", "output file") | |
flag.BoolVar(&options.Switch, true, "switch") | |
// ... | |
flag.Parse() | |
} | |
func main() { | |
var options = &Options{} | |
parseFlags(options) | |
if err := options.Valid(); err != nil { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment