Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
package main
import "os"
func makeDirectoryIfNotExists(path string) error {
if _, err := os.Stat(path); os.IsNotExist(err) {
return os.Mkdir(path, os.ModeDir|0755)
return nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment