Skip to content

Commit

Permalink
Break binary data up into multiple lines
Browse files Browse the repository at this point in the history
  • Loading branch information
spencerhakim authored and shuLhan committed Sep 9, 2017
1 parent 32b0afc commit accfe6a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions release.go
Expand Up @@ -248,7 +248,7 @@ func (fi bindataFileInfo) Sys() interface{} {
}

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

func compressed_memcopy(w io.Writer, asset *Asset, r io.Reader) error {
_, err := fmt.Fprintf(w, `var _%s = []byte("`, asset.Func)
_, err := fmt.Fprintf(w, "var _%s = []byte(\n\t\"", asset.Func)
if err != nil {
return err
}
Expand Down
5 changes: 5 additions & 0 deletions stringwriter.go
Expand Up @@ -28,6 +28,11 @@ func (w *StringWriter) Write(p []byte) (n int, err error) {
buf[3] = lowerHex[b%16]
w.Writer.Write(buf)
w.c++

// 28 fits nicely with tab width at 4 and a 120 char line limit
if w.c % 28 == 0 {
w.Writer.Write([]byte("\" +\n\t\""))
}
}

n++
Expand Down

0 comments on commit accfe6a

Please sign in to comment.