Created
January 18, 2017 10:39
-
-
Save crgimenes/fdde6c8c87fd7b4fe816a495f108aa12 to your computer and use it in GitHub Desktop.
create directory if not exist, also create all missing tree entries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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