Browse Source

Upgrade go-bindata to latest version

Ask Bjørn Hansen 11 years ago
parent
commit
58a655edbf
5 changed files with 126 additions and 86 deletions
  1. 2 2
      Makefile
  2. 7 2
      monitor.go
  3. 113 78
      status.html.go
  4. 0 0
      templates/status.html
  5. 4 4
      templates_devel.go

+ 2 - 2
Makefile

@@ -1,8 +1,8 @@
 
 all: status.html.go
 
-status.html.go: status.html
-	go-bindata  -i status.html -o status.html.go.tmp -p main -f status_html
+status.html.go: templates/*.html
+	go-bindata  -o status.html.go.tmp templates/
 	@echo "// +build !devel\n" > status.html.go
 	@cat status.html.go.tmp >> status.html.go
 	@rm status.html.go.tmp

+ 7 - 2
monitor.go

@@ -281,8 +281,13 @@ func StatusServer(zones Zones) func(http.ResponseWriter, *http.Request) {
 			}
 		}
 
-		tmpl := template.New("status_html")
-		tmpl, err := tmpl.Parse(string(status_html()))
+		statusTemplate, err := templates_status_html()
+		if err != nil {
+			log.Println("Could not read template", err)
+			w.WriteHeader(500)
+			return
+		}
+		tmpl, err := template.New("status_html").Parse(string(statusTemplate))
 
 		if err != nil {
 			str := fmt.Sprintf("Could not parse template: %s", err)

+ 113 - 78
status.html.go

@@ -5,89 +5,124 @@ package main
 import (
 	"bytes"
 	"compress/gzip"
+	"fmt"
 	"io"
+	"strings"
 )
 
-// status_html returns raw, uncompressed file data.
-func status_html() []byte {
-	gz, err := gzip.NewReader(bytes.NewBuffer([]byte{
-0x1f,0x8b,0x08,0x00,0x00,0x09,0x6e,0x88,0x00,0xff,0xb4,0x57,
-0x4d,0x53,0xeb,0x36,0x14,0x5d,0x27,0xbf,0x42,0xe3,0x29,0xbb,
-0x22,0x13,0x4a,0x66,0x1a,0xea,0x78,0x03,0x0c,0x5d,0x34,0x14,
-0x9a,0xb6,0x8b,0xb7,0x53,0xac,0x9b,0xd8,0xf3,0x1c,0x29,0x4f,
-0x52,0x08,0xbc,0x4c,0xfe,0xfb,0xbb,0x92,0x3f,0x62,0x3b,0x26,
-0x04,0xbf,0x61,0x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,0x4d,0x9d,0x0b,0x91,0x9b,0xcc,0x4b,0x3a,0x42,
-0xbd,0x56,0x63,0xd6,0x9d,0x19,0xba,0xd0,0xba,0xf9,0x2b,0x2e,
-0x6c,0x5e,0x8b,0xd6,0xb8,0x47,0xf3,0x10,0x57,0xd6,0xcb,0x2e,
-0x4a,0xae,0x26,0x6f,0x11,0xee,0x94,0x2d,0x17,0xfa,0x76,0x0b,
-0x82,0xdb,0x78,0xc5,0x20,0x57,0x9d,0x26,0xd0,0x94,0x7d,0xe3,
-0xb0,0x53,0x75,0xe7,0x01,0x4e,0x15,0x9e,0x05,0x3f,0xa2,0xbc,
-0x1a,0xef,0xb3,0xa4,0xf7,0xcb,0xd1,0xbe,0x6f,0xee,0xdb,0x66,
-0xf6,0x61,0x8c,0xdd,0xd2,0xfe,0x97,0xd1,0xff,0x11,0x00,0x00,
-0xff,0xff,0xb0,0x9d,0x52,0xc9,0x6d,0x0c,0x00,0x00,
-	}))
-
+func bindata_read(data []byte, name string) ([]byte, error) {
+	gz, err := gzip.NewReader(bytes.NewBuffer(data))
 	if err != nil {
-		panic("Decompression failed: " + err.Error())
+		return nil, fmt.Errorf("Read %q: %v", name, err)
 	}
 
-	var b bytes.Buffer
-	io.Copy(&b, gz)
+	var buf bytes.Buffer
+	_, err = io.Copy(&buf, gz)
 	gz.Close()
 
-	return b.Bytes()
-}
+	if err != nil {
+		return nil, fmt.Errorf("Read %q: %v", name, err)
+	}
+
+	return buf.Bytes(), nil
+}
+
+func templates_status_html() ([]byte, error) {
+	return bindata_read([]byte{
+		0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x00, 0xff, 0xb4, 0x57,
+		0x4d, 0x53, 0xeb, 0x36, 0x14, 0x5d, 0x27, 0xbf, 0x42, 0xe3, 0x29, 0xbb,
+		0x22, 0x13, 0x4a, 0x66, 0x1a, 0xea, 0x78, 0x03, 0x0c, 0x5d, 0x34, 0x14,
+		0x9a, 0xb6, 0x8b, 0xb7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17, 0xfa, 0x76, 0x0b,
+		0x82, 0xdb, 0x78, 0xc5, 0x20, 0x57, 0x9d, 0x26, 0xd0, 0x94, 0x7d, 0xe3,
+		0xb0, 0x53, 0x75, 0xe7, 0x01, 0x4e, 0x15, 0x9e, 0x05, 0x3f, 0xa2, 0xbc,
+		0x1a, 0xef, 0xb3, 0xa4, 0xf7, 0xcb, 0xd1, 0xbe, 0x6f, 0xee, 0xdb, 0x66,
+		0xf6, 0x61, 0x8c, 0xdd, 0xd2, 0xfe, 0x97, 0xd1, 0xff, 0x11, 0x00, 0x00,
+		0xff, 0xff, 0xb0, 0x9d, 0x52, 0xc9, 0x6d, 0x0c, 0x00, 0x00,
+	},
+		"templates/status.html",
+	)
+}
+
+// Asset loads and returns the asset for the given name.
+// It returns an error if the asset could not be found or
+// could not be loaded.
+func Asset(name string) ([]byte, error) {
+	cannonicalName := strings.Replace(name, "\\", "/", -1)
+	if f, ok := _bindata[cannonicalName]; ok {
+		return f()
+	}
+	return nil, fmt.Errorf("Asset %s not found", name)
+}
+
+// AssetNames returns the names of the assets.
+func AssetNames() []string {
+	names := make([]string, 0, len(_bindata))
+	for name := range _bindata {
+		names = append(names, name)
+	}
+	return names
+}
+
+// _bindata is a table, holding each asset generator, mapped to its name.
+var _bindata = map[string]func() ([]byte, error){
+	"templates/status.html": templates_status_html,
+}

+ 0 - 0
status.html → templates/status.html


+ 4 - 4
templates_devel.go

@@ -7,11 +7,11 @@ import (
 	"log"
 )
 
-func status_html() []byte {
-	data, err := ioutil.ReadFile("status.html")
+func templates_status_html() ([]byte, error) {
+	data, err := ioutil.ReadFile("templates/status.html")
 	if err != nil {
 		log.Println("Could not open status.html", err)
-		return []byte{}
+		return nil, err
 	}
-	return data
+	return data, nil
 }