title: parse go flags with more than one value
body: <p>I've the following code and I need to get the values like <code>val1</code> and <code>val2</code> and <code>arg1</code> and <code>arg2</code> and print it, I've tried many ways, is it possible ?</p>
  <pre><code>package main
  
  import (
      &quot;flag&quot;
      &quot;fmt&quot;
      &quot;strings&quot;
  )
  
  func main() {
      args := strings.Fields(&quot;-loc .env -names val1 val2 -tags arg1 arg2&quot;)
  
  
  
      FlagSet := flag.NewFlagSet(&quot;FlagSet&quot;, flag.ContinueOnError)
      loc := FlagSet.String(&quot;loc&quot;, &quot;&quot;, &quot;&quot;)
      name := FlagSet.String(&quot;names&quot;, &quot;&quot;, &quot;&quot;)
      tags := FlagSet.String(&quot;tags&quot;, &quot;&quot;, &quot;&quot;)
      
  
      FlagSet.Parse(args)
  
      fmt.Printf(&quot;location: %s \n&quot;, *loc)
      fmt.Printf(&quot;name: %s \n&quot;, *name)
      fmt.Printf(&quot;tags: %s \n&quot;, *tags)
  }
  </code></pre>
  <p><a href="https://play.golang.org/p/8aN5-0EZ2OT" rel="nofollow noreferrer">https://play.golang.org/p/8aN5-0EZ2OT</a></p>