script: Use strings instead of byte slice literals in asset generation
It compiles literally 50 times faster and generates the same code. Also add the little header that indicates auto generated code.
This commit is contained in:
@@ -23,7 +23,9 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
var tpl = template.Must(template.New("assets").Parse(`package auto
|
||||
var tpl = template.Must(template.New("assets").Parse(`// Code generated by genassets.go - DO NOT EDIT.
|
||||
|
||||
package auto
|
||||
|
||||
const Generated int64 = {{.Generated}}
|
||||
|
||||
@@ -70,7 +72,7 @@ func walkerFor(basePath string) filepath.WalkFunc {
|
||||
name, _ = filepath.Rel(basePath, name)
|
||||
assets = append(assets, asset{
|
||||
Name: filepath.ToSlash(name),
|
||||
Data: fmt.Sprintf("%#v", buf.Bytes()), // "[]byte{0x00, 0x01, ...}"
|
||||
Data: fmt.Sprintf("[]byte(%q)", buf.String()),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user