From f51e2f61850a4395d9a229f967699cfb7035fb7b Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 10 Feb 2022 10:58:55 -0500 Subject: [PATCH] remove temp file if not used rather than overwrite and leave a dangling file at the end --- go.mod | 2 +- main.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 04e0ecb..30fdc9c 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module git.teamworkapps.com/shortcut/imageoptimizer go 1.17 -require github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect +require github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 diff --git a/main.go b/main.go index 236e095..cac6522 100644 --- a/main.go +++ b/main.go @@ -185,6 +185,8 @@ func doSingleImage(f string, c config, s stats) stats { f, SIFormat(uint64(st.Size())), st.Size(), SIFormat(uint64(stt.Size())), stt.Size(), diff) } s.EndingBytes += uint64(st.Size()) + os.Remove("imageoptimizer.tmp") + } s.FilesProcessed++