Skip to content

Instantly share code, notes, and snippets.

@crgimenes
Created January 18, 2017 10:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crgimenes/fdde6c8c87fd7b4fe816a495f108aa12 to your computer and use it in GitHub Desktop.
Save crgimenes/fdde6c8c87fd7b4fe816a495f108aa12 to your computer and use it in GitHub Desktop.
create directory if not exist, also create all missing tree entries
func createDirIfNotExist(pathName string) (err error) {
if _, err = os.Stat(pathName); err != nil {
if os.IsNotExist(err) {
err = os.MkdirAll(pathName, os.ModePerm)
return
}
}
return
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment