title: How do I truncate and completely rewrite a file without having leading zeros?
body: <p>When truncating a file it seems to be adding additional zero bytes to the start:</p>
  
  <pre><code>configFile, err := os.OpenFile("./version.json", os.O_RDWR, 0666)
  defer configFile.Close()
  check(err)
  //some actions happen here
  configFile.Truncate(0)
  configFile.Write(js)
  configFile.Sync()
  </code></pre>
  
  <p>As a result the file has the contents I write with a section of <code>0</code> bytes at the beginning.</p>
  
  <p>How do I truncate and completely rewrite a file without having leading zeros?</p>