<p>Because this was missing from the std lib:</p>
<p><a href="https://github.com/mcandre/go-mkdir" rel="nofollow">https://github.com/mcandre/go-mkdir</a></p>
<hr/>**评论:**<br/><br/>TheMerovius: <pre><p><a href="https://godoc.org/os#MkdirAll" rel="nofollow">It's not missing</a></p></pre>mcandre: <pre><p>Er, Go's Mkdir fails if the path already exists. We want <code>mkdir -p</code> behavior (<code>mkdir</code> in Windows).</p></pre>TheMerovius: <pre><blockquote>
<p>Er, Go's Mkdir fails if the path already exists.</p>
</blockquote>
<p><a href="https://golang.org/src/os/path.go#L24" rel="nofollow">No, it doesn't.</a></p>
<p>(humz, to be more precise: Mkdir might, but MkdirAll, which I linked to, doesn't)</p></pre>mcandre: <pre><p>Confirmed. Deprecating my mkdir.go with maximum force!</p></pre>justinisrael: <pre><p>That was quite alot of build time requirements listed for a project that provides a 3 line function. I don't think it is quite common in the Go community to create such small utility libraries. Especially one that provides a single 3 line wrapper function around mkdir </p></pre>