diff --git a/views.go b/views.go index bd9d74cc2..3f08a47c4 100644 --- a/views.go +++ b/views.go @@ -4,9 +4,6 @@ import ( "crypto/sha1" "encoding/json" "fmt" - "github.com/cloudflare/unsee/config" - "github.com/cloudflare/unsee/models" - "github.com/cloudflare/unsee/store" "io" "net/http" "sort" @@ -14,10 +11,19 @@ import ( "strings" "time" + "github.com/cloudflare/unsee/config" + "github.com/cloudflare/unsee/models" + "github.com/cloudflare/unsee/store" + log "github.com/Sirupsen/logrus" "github.com/gin-gonic/gin" ) +var ( + // needed for serving favicon from binary assets + faviconFileServer = http.FileServer(newBinaryFileSystem("static")) +) + func boolInSlice(boolArray []bool, value bool) bool { for _, s := range boolArray { if s == value { @@ -262,7 +268,5 @@ func autocomplete(c *gin.Context) { } func favicon(c *gin.Context) { - fs := newBinaryFileSystem("static") - fileserver := http.FileServer(fs) - fileserver.ServeHTTP(c.Writer, c.Request) + faviconFileServer.ServeHTTP(c.Writer, c.Request) }