title: Unit test different flag values
body: <p>I have the following Golang code:</p>
  
  <pre><code>func getConfigFile() string {
      var configFile string
      flag.StringVar(&amp;configFile, "config", "", "File containing configuration")
      flag.Parse()
      return configFile
  }
  </code></pre>
  
  <p>This function is used elsewhere in my code, and I'd like to unit test what happens here when the user provides different values for the config argument (the config file name is used else where).<br>
  Is there a way to tell the flag package to return different values for the config argument while under test?</p>