Skip to content

Commit 152f1e1

Browse files
authored
fix: Close files in docs (#995)
This should fix an error on windows where file couldn't be removed because it was still open
1 parent 19e1b7c commit 152f1e1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

docs/markdown.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ func (g *Generator) renderTablesAsMarkdown(dir string) error {
3838
if err != nil {
3939
return fmt.Errorf("failed to create file %v: %v", outputPath, err)
4040
}
41+
defer f.Close()
4142
f.WriteString(content)
4243
return nil
4344
}
@@ -74,6 +75,7 @@ func (g *Generator) renderTable(dir string, table *schema.Table) error {
7475
if err != nil {
7576
return fmt.Errorf("failed to create file %v: %v", outputPath, err)
7677
}
78+
defer f.Close()
7779
f.WriteString(content)
7880
return f.Close()
7981
}

0 commit comments

Comments
 (0)