Skip to content

Commit

Permalink
🐛 Now multiple programs or goroutines calling MkdirTemp simultaneousl…
Browse files Browse the repository at this point in the history
…y will not choose the same directory
  • Loading branch information
noyshabtay committed Apr 7, 2024
1 parent bb669f3 commit 8a9bf5a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion utils/fileutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ func GetFileContentAndInfo(filePath string) (fileContent []byte, fileInfo os.Fil
func CreateTempDir() (string, error) {
tempDirBase := os.TempDir()
timestamp := strconv.FormatInt(time.Now().Unix(), 10)
return os.MkdirTemp(tempDirBase, tempDirPrefix+timestamp+"-")
return os.MkdirTemp(tempDirBase, tempDirPrefix+timestamp+"*")
}

func RemoveTempDir(dirPath string) error {
Expand Down

0 comments on commit 8a9bf5a

Please sign in to comment.