title: Flag command line parsing in golang
body: <p>I'm not sure I understand the reasoning behind this example (taken from <a href="https://github.com/golang-samples/flag/blob/master/visit/main.go" rel="noreferrer">here</a>), nor what it is trying to communicate about the Go language:</p>
  
  <pre><code>package main
  
  import (
      "flag"
      "fmt"
  )
  
  func main() {
      f := flag.NewFlagSet("flag", flag.ExitOnError)
      f.Bool("bool", false, "this is bool flag")
      f.Int("int", 0, "this is int flag")
  
      visitor := func(a *flag.Flag) {
          fmt.Println("&gt;", a.Name, "value=", a.Value)
      }
  
      fmt.Println("Visit()")
      f.Visit(visitor)
      fmt.Println("VisitAll()")
      f.VisitAll(visitor)
  
      // set flags
      f.Parse([]string{"-bool", "-int", "100"})
  
      fmt.Println("Visit() after Parse()")
      f.Visit(visitor)
      fmt.Println("VisitAll() after Parse()")
      f.VisitAll(visitor)
  }
  </code></pre>
  
  <p>Something along the lines of the setup they have but then adding a</p>
  
  <pre><code>int_val := f.get("int")
  </code></pre>
  
  <p>to get the named argument would seem more useful. I'm completely new to Go, so just trying to get acquainted with the language.</p>