Created
April 25, 2021 19:48
-
-
Save Ramko9999/7f26a6ecc8ebcec61cd5ee1c4efd52ec to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import ( | |
"log" | |
"os" | |
) | |
/* | |
os.MkdirTemp takes in the path to make the temporary dir and a pattern. | |
os.MkdirTemp will make a new directory with a name which is the pattern + a random string. | |
Ex: if "transform" was my pattern, a potential temp directory can be: | |
./temporary/transform952209073 | |
*/ | |
func makeTempDir(){ | |
dirName, err := os.MkdirTemp("./temporary", "transform"); | |
defer os.RemoveAll(dirName); // remove all contents in a directory | |
if err != nil { | |
log.Fatal(err); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment