From fe3cc6eb7bef35dd060e338b38ac1e02bfb94c8a Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 29 Oct 2019 10:24:55 +0100 Subject: [PATCH] cli/context/store: SA5001: should check returned error before deferring f.Close() (staticcheck) ``` cli/context/store/store_test.go:156:2: SA5001: should check returned error before deferring f.Close() (staticcheck) defer f.Close() ^ cli/context/store/store_test.go:189:2: SA5001: should check returned error before deferring f.Close() (staticcheck) defer f.Close() ^ cli/context/store/store_test.go:240:2: SA5001: should check returned error before deferring f.Close() (staticcheck) defer f.Close() ^ ``` Signed-off-by: Sebastiaan van Stijn --- cli/context/store/store_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/context/store/store_test.go b/cli/context/store/store_test.go index dd8586551d..d1d92b250c 100644 --- a/cli/context/store/store_test.go +++ b/cli/context/store/store_test.go @@ -153,8 +153,8 @@ func TestImportTarInvalid(t *testing.T) { tf := path.Join(testDir, "test.context") f, err := os.Create(tf) - defer f.Close() assert.NilError(t, err) + defer f.Close() tw := tar.NewWriter(f) hdr := &tar.Header{ @@ -186,8 +186,8 @@ func TestImportZip(t *testing.T) { zf := path.Join(testDir, "test.zip") f, err := os.Create(zf) - defer f.Close() assert.NilError(t, err) + defer f.Close() w := zip.NewWriter(f) meta, err := json.Marshal(Metadata{ @@ -237,8 +237,8 @@ func TestImportZipInvalid(t *testing.T) { zf := path.Join(testDir, "test.zip") f, err := os.Create(zf) - defer f.Close() assert.NilError(t, err) + defer f.Close() w := zip.NewWriter(f) df, err := w.Create("dummy-file")