Output files are not formatted in accordance with go fmt.
This commit is contained in:
parent
7bd7bcfcdf
commit
28919a6a56
|
@ -9,7 +9,11 @@ import (
|
||||||
"io"
|
"io"
|
||||||
)
|
)
|
||||||
|
|
||||||
var newline = []byte{'\n'}
|
var (
|
||||||
|
newline = []byte{'\n'}
|
||||||
|
dataindent = []byte{'\t', '\t'}
|
||||||
|
space = []byte{' '}
|
||||||
|
)
|
||||||
|
|
||||||
type ByteWriter struct {
|
type ByteWriter struct {
|
||||||
io.Writer
|
io.Writer
|
||||||
|
@ -24,7 +28,10 @@ func (w *ByteWriter) Write(p []byte) (n int, err error) {
|
||||||
for n = range p {
|
for n = range p {
|
||||||
if w.c%12 == 0 {
|
if w.c%12 == 0 {
|
||||||
w.Writer.Write(newline)
|
w.Writer.Write(newline)
|
||||||
|
w.Writer.Write(dataindent)
|
||||||
w.c = 0
|
w.c = 0
|
||||||
|
} else {
|
||||||
|
w.Writer.Write(space)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Fprintf(w.Writer, "0x%02x,", p[n])
|
fmt.Fprintf(w.Writer, "0x%02x,", p[n])
|
||||||
|
|
|
@ -21,7 +21,8 @@ func CreateTOC(dir, pkgname string) error {
|
||||||
// After startup of the program, all generated data files will
|
// After startup of the program, all generated data files will
|
||||||
// put themselves in this map. The key is the full filename, as
|
// put themselves in this map. The key is the full filename, as
|
||||||
// supplied to go-bindata.
|
// supplied to go-bindata.
|
||||||
var go_bindata = make(map[string]func() []byte)`, pkgname)
|
var go_bindata = make(map[string]func() []byte)
|
||||||
|
`, pkgname)
|
||||||
|
|
||||||
return ioutil.WriteFile(file, []byte(code), 0600)
|
return ioutil.WriteFile(file, []byte(code), 0600)
|
||||||
}
|
}
|
||||||
|
@ -31,7 +32,6 @@ var go_bindata = make(map[string]func() []byte)`, pkgname)
|
||||||
func WriteTOCInit(output io.Writer, filename, prefix, funcname string) {
|
func WriteTOCInit(output io.Writer, filename, prefix, funcname string) {
|
||||||
filename = strings.Replace(filename, prefix, "", 1)
|
filename = strings.Replace(filename, prefix, "", 1)
|
||||||
fmt.Fprintf(output, `
|
fmt.Fprintf(output, `
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
go_bindata[%q] = %s
|
go_bindata[%q] = %s
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,8 @@ func %s() []byte {
|
||||||
gz.Close()
|
gz.Close()
|
||||||
|
|
||||||
return b.Bytes()
|
return b.Bytes()
|
||||||
}`)
|
}
|
||||||
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// input -> gzip -> gowriter -> output.
|
// input -> gzip -> gowriter -> output.
|
||||||
|
@ -77,7 +78,8 @@ func %s() []byte {
|
||||||
|
|
||||||
fmt.Fprint(output, `
|
fmt.Fprint(output, `
|
||||||
}
|
}
|
||||||
}`)
|
}
|
||||||
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// input -> gzip -> gowriter -> output.
|
// input -> gzip -> gowriter -> output.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user