title: How to specify positional arguments with the flag package in Golang?
body: <p>Sometimes I want to pass an argument on the command line with no name, say a command like <code>wc</code>, which takes a filename as input:</p>
  
  <pre><code>wc filename.txt
  </code></pre>
  
  <p>With the <a href="http://golang.org/pkg/flag/">flag package</a>, it looks like every flag has to be given a name, with a default value if unspecified.</p>
  
  <pre><code>filename := flag.String("filename", "foo.txt", "Which file to count the words for")
  </code></pre>
  
  <p>However I don't want a default value, I want the program to exit with an error code if an argument is not specified. How would I add a required argument to a Go binary?</p>
  
  <p>I would also like to be able to parse arguments with type information, so just checking the Args() directly doesn't quite do it.</p>