jsonfilelog_test: check err from open before close
Fix warnings like this one:
> daemon/logger/jsonfilelog/jsonfilelog_test.go:191:3: SA5001: should check returned error before deferring file.Close() (staticcheck)
> 		defer file.Close()
>		^
@@ -188,15 +188,15 @@ func TestJSONFileLoggerWithOpts(t *testing.T) {
}
file, err := os.Open(filename + ".1.gz")
- defer file.Close()
if err != nil {
t.Fatal(err)
}
+ defer file.Close()
zipReader, err := gzip.NewReader(file)
- defer zipReader.Close()
if err != nil {
t.Fatal(err)
}
+ defer zipReader.Close()
penUlt, err = ioutil.ReadAll(zipReader)
if err != nil {
t.Fatal(err)
@@ -204,15 +204,15 @@ func TestJSONFileLoggerWithOpts(t *testing.T) {
}
file, err := os.Open(filename + ".2.gz")
- defer file.Close()
if err != nil {
t.Fatal(err)
}
+ defer file.Close()
zipReader, err := gzip.NewReader(file)
- defer zipReader.Close()
if err != nil {
t.Fatal(err)
}
+ defer zipReader.Close()
antepenult, err := ioutil.ReadAll(zipReader)
if err != nil {
t.Fatal(err)
