From 337e451cc75031300eecb48df7c4d8ed5df9d7bc Mon Sep 17 00:00:00 2001 From: Seebs Date: Fri, 7 Feb 2020 11:43:10 -0600 Subject: [PATCH] lint and review changes Log an error in the probably-irrelevant case where we ended up with a file, but Stat failed, which shouldn't ever happen we hope anyway. Also explicitly discard the status from RemapRoaringStorage in a case where we don't care. --- fragment.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fragment.go b/fragment.go index dfc0e759c..13a4c8621 100644 --- a/fragment.go +++ b/fragment.go @@ -296,6 +296,9 @@ func (f *fragment) applyStorage(data []byte, file *os.File, newGen generation, m if len(data) == 0 { if file != nil { fi, err := file.Stat() + if err != nil { + f.Logger.Printf("trying to apply new storage to existing bitmap, stat failed: %v", err) + } if err == nil && fi != nil && fi.Size() == 0 { return f.emptyStorage(file) } @@ -305,7 +308,7 @@ func (f *fragment) applyStorage(data []byte, file *os.File, newGen generation, m // our containers to use that storage *to take advantage of // mmap*, we'll just make sure our containers aren't pointing to // old storage and say "nope". - f.storage.RemapRoaringStorage(nil) + _, _ = f.storage.RemapRoaringStorage(nil) f.storage.SetSource(nil) return false, nil }