summaryrefslogtreecommitdiff
path: root/fonttobytes/main.go
diff options
context:
space:
mode:
authorNick White <git@njw.name>2019-11-12 16:28:11 +0000
committerNick White <git@njw.name>2019-11-12 16:36:08 +0000
commit61cb51730c2e3dbbea544a0ff5bc6628be76a54d (patch)
treeff2ccc6e45868d6d41cda979a2792baf10e358f6 /fonttobytes/main.go
parent656e6a50ef50ad73b2039cb1193dc84ac1883541 (diff)
Clean up, and add comment explaining design choice to fonttobytes
Diffstat (limited to 'fonttobytes/main.go')
-rw-r--r--fonttobytes/main.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/fonttobytes/main.go b/fonttobytes/main.go
index ed0752c..8310e0f 100644
--- a/fonttobytes/main.go
+++ b/fonttobytes/main.go
@@ -36,15 +36,14 @@ func main() {
w.Write(fontbytes)
w.Close()
+ // This could be done with %+v in printf, but using the decimal rather than
+ // hex output saves quite a few bytes, so we do that instead.
fmt.Printf("[]byte{")
- first := true
- for _, b := range compressed.Bytes() {
- if first {
- fmt.Printf("%d", b)
- first = false
- continue
+ for i, b := range compressed.Bytes() {
+ if i > 0 {
+ fmt.Printf(", ")
}
- fmt.Printf(", %d", b)
+ fmt.Printf("%d", b)
}
fmt.Printf("}\n")
}