Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Be more nice when breaking lines.

  • Loading branch information...
commit 09174ae66b3df769523ccea709db79c247a4b35b 1 parent b4d735d
@nsf authored
Showing with 15 additions and 11 deletions.
  1. +15 −11 bin2go.go
View
26 bin2go.go
@@ -73,17 +73,21 @@ func writeData(data []byte, out io.Writer) {
n += 6
- // be readable, break line after 78 characters
- if n >= 78 {
- _, err = fmt.Fprint(out, "\n\t")
- checkOutputFailure(err)
-
- n = 8
- } else if i != lastbytei {
- // if this is not the last byte and we're not
- // breaking the line, insert space after ','
- _, err = fmt.Fprint(out, " ")
- checkOutputFailure(err)
+ // if this is not the last byte
+ if i != lastbytei {
+ // be readable, break line after 78 characters
+ if n >= 78 {
+ _, err = fmt.Fprint(out, "\n\t")
+ checkOutputFailure(err)
+
+ n = 8
+ } else {
+ // if we're not breaking the line, insert space
+ // after ','
+ _, err = fmt.Fprint(out, " ")
+ checkOutputFailure(err)
+ }
+
}
}
_, err = fmt.Fprint(out, "\n}\n")
Please sign in to comment.
Something went wrong with that request. Please try again.