From 0ef6de982e166a40706e40e7a092951a8e00cf08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= Date: Thu, 23 May 2019 14:01:08 +0200 Subject: [PATCH] Create tempfile in the output directory --- stringer.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stringer.go b/stringer.go index 5788650..edd8063 100644 --- a/stringer.go +++ b/stringer.go @@ -134,7 +134,8 @@ func main() { } // Write to tmpfile first - tmpFile, err := ioutil.TempFile("", fmt.Sprintf("%s_enumer_", types[0])) + tmpName := fmt.Sprintf("%s_enumer_", filepath.Base(types[0])) + tmpFile, err := ioutil.TempFile(filepath.Dir(types[0]), tmpName) if err != nil { log.Fatalf("creating temporary file for output: %s", err) }