clean up codes

This commit is contained in:
ranbo chen 2017-10-31 21:08:56 +08:00 committed by Your Name
parent 90de381cdb
commit 19340a382d
2 changed files with 2 additions and 5 deletions

5
wal.go
View file

@ -714,10 +714,7 @@ func (w *SegmentWAL) Close() error {
return errors.Wrapf(hf.Close(), "closing WAL head %s", hf.Name()) return errors.Wrapf(hf.Close(), "closing WAL head %s", hf.Name())
} }
if w.dirFile != nil { return w.dirFile.Close()
w.dirFile.Close()
}
return nil
} }
const ( const (

View file

@ -273,7 +273,7 @@ func TestWALRestoreCorrupted_invalidSegment(t *testing.T) {
Ok(t, err) Ok(t, err)
f2, err := wal.createSegmentFile(dir + "/000002") f2, err := wal.createSegmentFile(dir + "/000002")
Ok(t, err) Ok(t, err)
Ok(t, f2.Close()) // close for windows! Ok(t, f2.Close())
// Make header of second segment invalid. // Make header of second segment invalid.
_, err = f.WriteAt([]byte{1, 2, 3, 4}, 0) _, err = f.WriteAt([]byte{1, 2, 3, 4}, 0)