From f137263fe9353a911aa6558df196461944a8335d Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Fri, 13 Oct 2023 11:11:30 +0200 Subject: [PATCH] misc: clean up immediately and avoid delayed defer Signed-off-by: Hidde Beydals --- internal/build/diff.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/build/diff.go b/internal/build/diff.go index c316df9f..0dd0d9a4 100644 --- a/internal/build/diff.go +++ b/internal/build/diff.go @@ -116,13 +116,14 @@ func (b *Builder) Diff() (string, bool, error) { if err != nil { return "", createdOrDrifted, err } - defer cleanupDir(tmpDir) err = diff(liveFile, mergedFile, &output) if err != nil { + cleanupDir(tmpDir) return "", createdOrDrifted, err } + cleanupDir(tmpDir) createdOrDrifted = true }