Skip to content

Commit 32259c8

Browse files
testwillonsi
authored andcommittedApr 27, 2024·
fix: close files
Signed-off-by: guoguangwu <guoguangwug@gmail.com>
1 parent 3134422 commit 32259c8

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed
 

‎ginkgo/generators/generate_command.go

+1
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ func moduleName(modRoot string) string {
174174
if err != nil {
175175
return ""
176176
}
177+
defer modFile.Close()
177178

178179
mod := make([]byte, 128)
179180
_, err = modFile.Read(mod)

‎ginkgo/internal/profiles_and_reports.go

+2
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ func MergeAndCleanupCoverProfiles(profiles []string, destination string) error {
161161
if err != nil {
162162
return err
163163
}
164+
defer dst.Close()
164165
err = DumpCoverProfiles(merged, dst)
165166
if err != nil {
166167
return err
@@ -196,6 +197,7 @@ func MergeProfiles(profilePaths []string, destination string) error {
196197
return fmt.Errorf("Could not open profile: %s\n%s", profilePath, err.Error())
197198
}
198199
prof, err := profile.Parse(proFile)
200+
_ = proFile.Close()
199201
if err != nil {
200202
return fmt.Errorf("Could not parse profile: %s\n%s", profilePath, err.Error())
201203
}

‎reporters/junit_report.go

+1
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ func MergeAndCleanupJUnitReports(sources []string, dst string) ([]string, error)
324324
continue
325325
}
326326
err = xml.NewDecoder(f).Decode(&report)
327+
_ = f.Close()
327328
if err != nil {
328329
messages = append(messages, fmt.Sprintf("Could not decode %s:\n%s", source, err.Error()))
329330
continue

0 commit comments

Comments
 (0)
Please sign in to comment.