cleanup output dir at start

This commit is contained in:
Kirill Zhuravlev 2023-02-04 03:01:22 +01:00 committed by Avelino
parent 3238f9c430
commit 05fe195266
No known key found for this signature in database
GPG Key ID: B345B4D52E98180A

14
main.go
View File

@ -45,8 +45,18 @@ var outIndexFile = filepath.Join(outDir, "index.html")
var outSitemapFile = filepath.Join(outDir, "sitemap.xml")
func main() {
outIndexAbs := filepath.Join(outDir, outIndexFile)
err := GenerateHTML(readmePath, outIndexAbs)
// Cleanup and re-create output directory
{
if err := os.RemoveAll(outDir); err != nil {
panic(err)
}
if err := mkdirAll(outDir); err != nil {
panic(err)
}
}
err := GenerateHTML(readmePath, outIndexFile)
if err != nil {
panic(err)
}