title: How to remove all contents of a directory using Golang?
body: <p>I'm new to Go and can't seem to find a way to delete all the contents of a directory when I don't know the contents.</p>
  
  <p>I've tried:</p>
  
  <pre><code>os.RemoveAll("/tmp/*")
  os.Remove("/tmp/*")
  </code></pre>
  
  <p>but get <code>remove *: no such file or directory</code> or <code>invalid argument</code>.</p>
  
  <p>And of course if you do:</p>
  
  <pre><code>os.RemoveAll("/tmp/")
  </code></pre>
  
  <p>it deletes the <code>tmp</code> directory as well. Which is not what I want.</p>