title: Go: Read a Command Line Flag from a File
body: <p>When creating a command line program in Go, is there a way (either provided by the core libraries, or a widely accepted practice) to implement a command line flag that reads its contents from a file?</p>
  
  <p>If that's not clear, I'm thinking of something like the <code>@</code> symbol in the command line <code>curl</code> program.  Many of curl's arguments allow you to do something like this to read a flag's value in from a file</p>
  
  <pre><code># setting the value 
  curl --data-binary '{...}' http://example.com
  
  # setting the value by reading from a file
  curl --data-binary @path/to/data.txt http://example.com  
  </code></pre>
  
  <p>Does go have any code for automatically implementing these sorts of flags?  I've read through the official docs and <a href="https://golang.org/pkg/flag/" rel="nofollow noreferrer">didn't see anything obvious</a>, but I'm still getting the hang of navigating those docs. </p>
  
  <p>If there's nothing official, is there a de-facto standard "better flags" library provided by someone in the go community that includes this functionality?</p>
  
  <p>Or is it down to an individual programmer to create a string flag, scan it for the @, and handle reading the file's contents in myself?</p>