title: How to handle gosec linter warning: Potential file inclusion via variable
body: <p>How do I solve the following warning from <a href="https://github.com/securego/gosec" rel="noreferrer">gosec</a> linter:</p>
  
  <pre><code>::warning: Potential file inclusion via variable,MEDIUM,HIGH (gosec)
  </code></pre>
  
  <p>The linter is warning me on the first line of this function:</p>
  
  <pre><code>func File2lines(filePath string) ([]string, error) {
      f, err := os.Open(filePath) //Warning here
      if err != nil {
          return nil, err
      }
      defer f.Close()
      return linesFromReader(f)
  }
  </code></pre>
  
  <p>I have tried reading up on local file inclusion, but cannot see how that would be applicable here.</p>