mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-22 02:48:59 +00:00
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:
parent
7b47692ec0
commit
793b86e604
@ -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()),
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user