Skip to content

Instantly share code, notes, and snippets.

@ivanzoid
Last active July 7, 2022 04:38
Show Gist options
  • Save ivanzoid/5040166bb3f0c82575b52c2ca5f5a60c to your computer and use it in GitHub Desktop.
Save ivanzoid/5040166bb3f0c82575b52c2ca5f5a60c to your computer and use it in GitHub Desktop.
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