title: Control fmt.Parse output on Parsing Error
body: <pre><code>var timesFlag int  
  flag.IntVar(&amp;timesFlag, "times", 1, "Number of times to print")
  flag.Parse()
  </code></pre>
  
  <p>If I run the program and type in prog -times=abc  (&lt;--- not an int)</p>
  
  <p>fmt.Parse spits out this ugly error message on the console:</p>
  
  <p><em>invalid value "-abc" for flag -times: strconv.ParseInt: parsing "-abc": invalid syntax</em></p>
  
  <p>Obviously, I can't prevent the user from typing in anything from the command line. The error looks like garbage to the user and needs to look more friendlier. How do I silent this error from going to stderr/stdout and detect there was an error generated?</p>