From 6b02f9e44fecce65fd729fba7430b4b8e5b45ba6 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Mon, 20 Jan 2014 23:08:29 +0100 Subject: [PATCH] Fix GUI files modtime (ish...) --- build.sh | 5 ----- gui.go | 13 ++++--------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/build.sh b/build.sh index 2e64f4ca6..4729b82a8 100755 --- a/build.sh +++ b/build.sh @@ -3,11 +3,6 @@ version=$(git describe --always) buildDir=dist -if [[ $1 == "-f" ]] ; then - fast=yes - shift -fi - if [[ $fast != yes ]] ; then go get -d go test ./... diff --git a/gui.go b/gui.go index e9a63d95f..7374b8235 100644 --- a/gui.go +++ b/gui.go @@ -6,7 +6,6 @@ import ( "log" "mime" "net/http" - "os" "path/filepath" "runtime" "sync" @@ -32,15 +31,9 @@ func startGUI(addr string, m *model.Model) { panic(err) } - var modt time.Time - fi, err := os.Stat(os.Args[0]) - if err != nil { - modt = fi.ModTime() - } - go func() { mr := martini.New() - mr.Use(embeddedStatic(fs, modt.UTC().Format(http.TimeFormat))) + mr.Use(embeddedStatic(fs)) mr.Use(martini.Recovery()) mr.Action(router.Handle) mr.Map(m) @@ -136,7 +129,9 @@ func restGetSystem(w http.ResponseWriter) { json.NewEncoder(w).Encode(res) } -func embeddedStatic(fs map[string][]byte, modt string) interface{} { +func embeddedStatic(fs map[string][]byte) interface{} { + var modt = time.Now().UTC().Format(http.TimeFormat) + return func(res http.ResponseWriter, req *http.Request, log *log.Logger) { file := req.URL.Path