From 915f53af230756c88bd860d1122b4d13b20ec906 Mon Sep 17 00:00:00 2001 From: Alisdair McDiarmid Date: Tue, 25 Aug 2020 08:35:32 -0400 Subject: [PATCH] internal: Clean up package install temp file The installFromHTTPURL function downloads a package to a temporary file, then delegates to installFromLocalArchive to install it. We were previously not deleting the temporary file afterwards. This commit fixes that. --- internal/providercache/package_install.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/providercache/package_install.go b/internal/providercache/package_install.go index a070637e6f..d8dd31266b 100644 --- a/internal/providercache/package_install.go +++ b/internal/providercache/package_install.go @@ -53,6 +53,7 @@ func installFromHTTPURL(ctx context.Context, meta getproviders.PackageMeta, targ return nil, fmt.Errorf("failed to open temporary file to download from %s", url) } defer f.Close() + defer os.Remove(f.Name()) // We'll borrow go-getter's "cancelable copy" implementation here so that // the download can potentially be interrupted partway through.