Create temporary file in same directory as the final fiel resides

If temp file is created on different parition, then move command will fail
This commit is contained in:
Miha Vrhovnik 2019-04-19 08:38:40 +02:00 committed by GitHub
parent 1cbec6c016
commit ceea85e531
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -141,7 +141,7 @@ func main() {
} }
// Write to tmpfile first // Write to tmpfile first
tmpFile, err := ioutil.TempFile("", fmt.Sprintf("%s_enumer_", typs[0])) tmpFile, err := ioutil.TempFile(dir, fmt.Sprintf("%s_enumer_", typs[0]))
if err != nil { if err != nil {
log.Fatalf("creating temporary file for output: %s", err) log.Fatalf("creating temporary file for output: %s", err)
} }