Fix GUI files modtime (ish...)

This commit is contained in:
Jakob Borg 2014-01-20 23:08:29 +01:00
parent 84d7452f9e
commit 6b02f9e44f
2 changed files with 4 additions and 14 deletions

View File

@ -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 ./...

13
gui.go
View File

@ -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