title: go-staticcheck: value of file is never used (SA4006)
body: <p>I wrote a function for logging errors, it works, but the IDE writes about an error(this value of file is never used (SA4006) go-staticcheck)</p>
  <p>Sample Code:</p>
  <pre><code>package main
  
  import (
      &quot;fmt&quot;
      &quot;log&quot;
      &quot;os&quot;
  )
  
  func errorLoger(err error, msg string) {
      fileWrite, _ := os.OpenFile(&quot;erroBot.log&quot;, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0644)
      log.SetOutput(fileWrite)
      log.Fatalf(&quot;%s:%s&quot;, err, msg)
  }
  
  func main() {
      fmt.Println(&quot;file Open&quot;)
      file, err := os.OpenFile(&quot;no-file.txt&quot;, os.O_APPEND|os.O_WRONLY, 0644)
      errorLoger(err, &quot;Error Open File&quot;)
      defer file.Close()
  }
  </code></pre>
  <p>Please clarify what is wrong and where I made a mistake.</p>