Skip to content

Commit bf7795e

Browse files
authored
metrics/vocabulary: err check before Close() (#425)
1 parent f702249 commit bf7795e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

metrics/vocabulary/vocabulary.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@ func WriteCSV(v *metrics.Vocabulary, filename string) error {
4343
filename = "vocabulary-operation.csv"
4444
}
4545
f4, ferror := os.Create(filename)
46-
defer f4.Close()
4746
if ferror != nil {
4847
return ferror
4948
}
49+
defer f4.Close()
50+
5051
for _, s := range v.Schemas {
5152
temp := fmt.Sprintf("%s,\"%s\",%d\n", "schemas", s.Word, int(s.Count))
5253
f4.WriteString(temp)

0 commit comments

Comments
 (0)