cmd/covdata: close output meta-data file

Change-Id: Idd2a324eb51ffa3f40cb3df03a82a1d6d882295a
GitHub-Last-Rev: 62e22b309d
GitHub-Pull-Request: golang/go#71993
Reviewed-on: https://go-review.googlesource.com/c/go/+/653140
Reviewed-by: Than McIntosh <thanm@golang.org>
Commit-Queue: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
guoguangwu 2025-02-27 05:56:52 +00:00 committed by Gopher Robot
parent 2298215f5b
commit 64feded8af
1 changed files with 6 additions and 0 deletions

View File

@ -241,6 +241,12 @@ func (mm *metaMerge) emitMeta(outdir string, pcombine bool) [16]byte {
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.
mfw := encodemeta.NewCoverageMetaFileWriter(fpath, mf)
err = mfw.Write(finalHash, blobs, mm.Mode(), mm.Granularity())