mirror of https://github.com/docker/cli.git
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 <github@gone.nl>
This commit is contained in:
parent
709728e723
commit
fe3cc6eb7b
|
@ -153,8 +153,8 @@ func TestImportTarInvalid(t *testing.T) {
|
||||||
tf := path.Join(testDir, "test.context")
|
tf := path.Join(testDir, "test.context")
|
||||||
|
|
||||||
f, err := os.Create(tf)
|
f, err := os.Create(tf)
|
||||||
defer f.Close()
|
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
defer f.Close()
|
||||||
|
|
||||||
tw := tar.NewWriter(f)
|
tw := tar.NewWriter(f)
|
||||||
hdr := &tar.Header{
|
hdr := &tar.Header{
|
||||||
|
@ -186,8 +186,8 @@ func TestImportZip(t *testing.T) {
|
||||||
zf := path.Join(testDir, "test.zip")
|
zf := path.Join(testDir, "test.zip")
|
||||||
|
|
||||||
f, err := os.Create(zf)
|
f, err := os.Create(zf)
|
||||||
defer f.Close()
|
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
defer f.Close()
|
||||||
w := zip.NewWriter(f)
|
w := zip.NewWriter(f)
|
||||||
|
|
||||||
meta, err := json.Marshal(Metadata{
|
meta, err := json.Marshal(Metadata{
|
||||||
|
@ -237,8 +237,8 @@ func TestImportZipInvalid(t *testing.T) {
|
||||||
zf := path.Join(testDir, "test.zip")
|
zf := path.Join(testDir, "test.zip")
|
||||||
|
|
||||||
f, err := os.Create(zf)
|
f, err := os.Create(zf)
|
||||||
defer f.Close()
|
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
defer f.Close()
|
||||||
w := zip.NewWriter(f)
|
w := zip.NewWriter(f)
|
||||||
|
|
||||||
df, err := w.Create("dummy-file")
|
df, err := w.Create("dummy-file")
|
||||||
|
|
Loading…
Reference in New Issue