title: Which combination of os.FileMode's corresponds to `a` in fopen, with respect to the permissions on the created file?
body: <p>Consider the following short program in Golang, which simply attempts to write a file.</p>
  
  <pre><code>package main
  
  import "io/ioutil"
  import "os"
  
  func main() {
      ioutil.WriteFile("/tmp/FooBar", []byte("Hello World"), os.ModeAppend)
  }
  </code></pre>
  
  <p>After running this program, I get a file with the following permissions.</p>
  
  <pre><code>---------- 1 merlin sudo 5 Oct 12 15:02 /tmp/FooBar
  </code></pre>
  
  <p>The permissions are essentially unuseable.</p>
  
  <p>If I run the equivalent C program.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main(){
      FILE* foo = fopen("/tmp/BarFoo", "a");
      fprintf(foo, "Hello World");
      fclose(foo);
  }
  </code></pre>
  
  <p>Then I get a file that looks like this, which is much more desirable.</p>
  
  <pre><code>-rw-r--r-- 1 merlin sudo 11 Oct 12 15:10 /tmp/BarFoo
  </code></pre>
  
  <p><strong>What is the correct combination of flags in the <code>Golang</code> program to produce a file with the same permissions as the C program?</strong></p>
  
  <p>I have looked at the <a href="https://golang.org/pkg/os/#FileMode" rel="nofollow">FileMode documentation</a> but did not see any good candidates.</p>