From a0342d75318029f48bb95e22b7c5ad5af901d6a6 Mon Sep 17 00:00:00 2001 From: Zhongpeng Lin Date: Thu, 25 Aug 2022 12:14:41 -0700 Subject: [PATCH] Writing temp file to os temp dir --- stringer.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stringer.go b/stringer.go index 49c87fd..7784cd3 100644 --- a/stringer.go +++ b/stringer.go @@ -18,7 +18,6 @@ import ( "go/importer" "go/token" "go/types" - "io/ioutil" "log" "os" "path/filepath" @@ -149,7 +148,7 @@ func main() { } // Write to tmpfile first - tmpFile, err := ioutil.TempFile(dir, fmt.Sprintf("%s_enumer_", typs[0])) + tmpFile, err := os.CreateTemp("", fmt.Sprintf("%s_enumer_", typs[0])) if err != nil { log.Fatalf("creating temporary file for output: %s", err) }