Output files are not formatted in accordance with go fmt.

pull/4/head
Paweł Błaszczyk 2014-01-03 19:08:52 +01:00
parent 7bd7bcfcdf
commit 28919a6a56
3 changed files with 14 additions and 5 deletions

View File

@ -9,7 +9,11 @@ import (
"io"
)
var newline = []byte{'\n'}
var (
newline = []byte{'\n'}
dataindent = []byte{'\t', '\t'}
space = []byte{' '}
)
type ByteWriter struct {
io.Writer
@ -24,7 +28,10 @@ func (w *ByteWriter) Write(p []byte) (n int, err error) {
for n = range p {
if w.c%12 == 0 {
w.Writer.Write(newline)
w.Writer.Write(dataindent)
w.c = 0
} else {
w.Writer.Write(space)
}
fmt.Fprintf(w.Writer, "0x%02x,", p[n])

View File

@ -21,7 +21,8 @@ func CreateTOC(dir, pkgname string) error {
// After startup of the program, all generated data files will
// put themselves in this map. The key is the full filename, as
// 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)
}
@ -31,7 +32,6 @@ var go_bindata = make(map[string]func() []byte)`, pkgname)
func WriteTOCInit(output io.Writer, filename, prefix, funcname string) {
filename = strings.Replace(filename, prefix, "", 1)
fmt.Fprintf(output, `
func init() {
go_bindata[%q] = %s
}

View File

@ -62,7 +62,8 @@ func %s() []byte {
gz.Close()
return b.Bytes()
}`)
}
`)
}
// input -> gzip -> gowriter -> output.
@ -77,7 +78,8 @@ func %s() []byte {
fmt.Fprint(output, `
}
}`)
}
`)
}
// input -> gzip -> gowriter -> output.