1
0
mirror of https://github.com/golang/go synced 2024-11-25 00:07:56 -07:00

cmd/covdata: close output meta-data file

Signed-off-by: guoguangwu <guoguangwug@gmail.com>
This commit is contained in:
guoguangwu 2024-04-01 21:30:32 +08:00
parent d49a14c609
commit 747308fd01

View File

@ -237,6 +237,11 @@ func (mm *metaMerge) emitMeta(outdir string, pcombine bool) [16]byte {
if err != nil { if err != nil {
fatal("unable to open output meta-data file %s: %v", fpath, err) fatal("unable to open output meta-data file %s: %v", fpath, err)
} }
defer func() {
if err := mf.Close(); err != nil {
fatal("error closing output meta-data file %s: %v", fpath, err)
}
}()
// Encode and write. // Encode and write.
mfw := encodemeta.NewCoverageMetaFileWriter(fpath, mf) mfw := encodemeta.NewCoverageMetaFileWriter(fpath, mf)