Fixes bytewriter to format output.
This commit is contained in:
parent
20077324b7
commit
bb0b560542
|
@ -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])
|
||||
|
|
Loading…
Reference in New Issue
Block a user