Permalink
Browse files

move flag parsing and sanity checks to init()

  • Loading branch information...
1 parent a774331 commit 59c5fd17c9d09014afb5ade569a688708423aa54 @falconindy committed Aug 31, 2010
Showing with 3 additions and 1 deletion.
  1. +3 −1 gobble.go
View
@@ -197,7 +197,7 @@ func vercmp(a, b string) int {
return w.ExitStatus()
}
-func main() {
+func init() {
flag.Parse()
flag.Usage = func() {
fmt.Println("usage: gobble [flags]")
@@ -229,7 +229,9 @@ func main() {
fmt.Fprintln(os.Stderr, "error: keep cannot equal 0")
os.Exit(5)
}
+}
+func main() {
d, err := os.Open(*cachePath, os.O_RDONLY, 0666)
if err != nil {
fmt.Fprintln(os.Stderr, err.String())

0 comments on commit 59c5fd1

Please sign in to comment.