Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created July 20, 2019 00:06
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 parzibyte/12b7ab8dae218aa5a3a9e62bc3fa1364 to your computer and use it in GitHub Desktop.
Save parzibyte/12b7ab8dae218aa5a3a9e62bc3fa1364 to your computer and use it in GitHub Desktop.
func crearDirectorioSiNoExiste(directorio string) {
if _, err := os.Stat(directorio); os.IsNotExist(err) {
err = os.Mkdir(directorio, 0755)
if err != nil {
// Aquí puedes manejar mejor el error, es un ejemplo
panic(err)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment