aboutsummaryrefslogtreecommitdiffstats
path: root/utils.go
diff options
context:
space:
mode:
authorEddy Pedroni <eddy@0xf7.com>2020-02-01 18:30:23 +0100
committerEddy Pedroni <eddy@0xf7.com>2020-02-01 18:30:34 +0100
commit633a882544d3b54cc7b7cfc96359a2ca1497d766 (patch)
treee0d677381b1647104a231103f12776d61c2a871e /utils.go
parentace49dc8ef6eb5236eed364f885ff6ed76554188 (diff)
Added CSS copy, img symlink generation
Diffstat (limited to 'utils.go')
-rw-r--r--utils.go19
1 files changed, 17 insertions, 2 deletions
diff --git a/utils.go b/utils.go
index 42780c4..db36745 100644
--- a/utils.go
+++ b/utils.go
@@ -2,6 +2,8 @@ package main
import (
"github.com/BurntSushi/toml"
+ "io/ioutil"
+ "os"
"strings"
)
@@ -13,8 +15,11 @@ type config struct {
BaseUrl string
}
-func readConfig(file string) (cfg config, err error) {
- _, err = toml.DecodeFile(file, &cfg)
+func readConfig(file string) (cfg config) {
+ _, err := toml.DecodeFile(file, &cfg)
+ if err != nil {
+ panic(err)
+ }
cfg.BaseUrl = strings.TrimSuffix(cfg.BaseUrl, "/")
return
}
@@ -25,3 +30,13 @@ func nameify(raw string) (clean string) {
clean = strings.Title(clean)
return
}
+
+func createTempDir(name string) (path string) {
+ path, err := ioutil.TempDir("", "godocs")
+ if err != nil {
+ panic(err)
+ }
+ defer os.RemoveAll(path)
+
+ return
+}