aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main.go18
-rw-r--r--page.go1
2 files changed, 18 insertions, 1 deletions
diff --git a/main.go b/main.go
index 870e0f9..5b444a8 100644
--- a/main.go
+++ b/main.go
@@ -19,6 +19,7 @@ func main() {
// create temporary target directory
tmp := createTempDir("godocs")
+ defer os.RemoveAll(tmp)
// gather all sites in docsRoot
sites := getSites(cfg)
@@ -42,4 +43,21 @@ func main() {
if err != nil {
panic(err)
}
+
+ // if we are here, generation succeeded, so we move the generated content to the target directory
+ err = os.RemoveAll(cfg.TargetDir)
+ if err != nil {
+ panic(err)
+ }
+
+ err = os.Rename(tmp, cfg.TargetDir)
+ if err != nil {
+ panic(err)
+ }
+
+ // fix because for some reason the generated directory ends up with the wrong permissions
+ err = os.Chmod(cfg.TargetDir, 0755)
+ if err != nil {
+ panic(err)
+ }
}
diff --git a/page.go b/page.go
index a88f437..be52e3c 100644
--- a/page.go
+++ b/page.go
@@ -55,7 +55,6 @@ func createPageMap(site *siteData, entries []Renderer) {
if err != nil {
panic(err)
}
-
}
// create landing page