Skip to content

Commit accfe6a

Browse files
spencerhakimshuLhan
authored andcommitted
Break binary data up into multiple lines
1 parent 32b0afc commit accfe6a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

release.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ func (fi bindataFileInfo) Sys() interface{} {
248248
}
249249

250250
func compressed_nomemcopy(w io.Writer, asset *Asset, r io.Reader) error {
251-
_, err := fmt.Fprintf(w, `var _%s = "`, asset.Func)
251+
_, err := fmt.Fprintf(w, "var _%s =\n\t\"", asset.Func)
252252
if err != nil {
253253
return err
254254
}
@@ -275,7 +275,7 @@ func %sBytes() ([]byte, error) {
275275
}
276276

277277
func compressed_memcopy(w io.Writer, asset *Asset, r io.Reader) error {
278-
_, err := fmt.Fprintf(w, `var _%s = []byte("`, asset.Func)
278+
_, err := fmt.Fprintf(w, "var _%s = []byte(\n\t\"", asset.Func)
279279
if err != nil {
280280
return err
281281
}

stringwriter.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ func (w *StringWriter) Write(p []byte) (n int, err error) {
2828
buf[3] = lowerHex[b%16]
2929
w.Writer.Write(buf)
3030
w.c++
31+
32+
// 28 fits nicely with tab width at 4 and a 120 char line limit
33+
if w.c % 28 == 0 {
34+
w.Writer.Write([]byte("\" +\n\t\""))
35+
}
3136
}
3237

3338
n++

0 commit comments

Comments
 (0)