summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main.go23
1 files changed, 12 insertions, 11 deletions
diff --git a/main.go b/main.go
index 050bb0e..9d499ba 100644
--- a/main.go
+++ b/main.go
@@ -29,8 +29,7 @@ var (
deleted *json.Encoder
deletedLog *os.File
deletedLock sync.RWMutex
-
- templates = template.Must(template.ParseGlob("templates/*.html"))
+ templates *template.Template
)
func getLogNames() ([]string, error) {
@@ -62,8 +61,8 @@ func getLog(log string) ([]map[string]interface{}, error) {
if err == io.EOF {
err = nil
}
- for i := len(entries)/2-1; i >= 0; i-- {
- j := len(entries)-1-i
+ for i := len(entries)/2 - 1; i >= 0; i-- {
+ j := len(entries) - 1 - i
entries[i], entries[j] = entries[j], entries[i]
}
return entries, err
@@ -317,6 +316,15 @@ func main() {
flag.Parse()
+ templates = template.Must(template.ParseGlob("templates/*.html"))
+
+ for _, dir := range []string{"log/", "upload/ids/", "upload/files/"} {
+ if _, err := os.Stat(path.Join(gomfRoot, dir)); err != nil {
+ fmt.Fprintf(os.Stderr, "error: %s; is --gomf-root set correctly?\n", err)
+ os.Exit(1)
+ }
+ }
+
access = make(map[string]string)
for _, s := range strings.Split(*accessFlag, ",") {
up := strings.Split(s, ":")
@@ -344,13 +352,6 @@ func main() {
http.Handle(deletionPath, http.HandlerFunc(handleDeletionLog))
}
- for _, dir := range []string{"log/", "upload/ids/", "upload/files/"} {
- if _, err := os.Stat(path.Join(gomfRoot, dir)); err != nil {
- fmt.Fprintf(os.Stderr, "error: %s; is --gomf-root set correctly?\n", err)
- os.Exit(1)
- }
- }
-
exit := true
if *listenHttp != "" {
exit = false