aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2018-09-28 23:29:42 +0200
committerDimitri Sokolyuk <demon@dim13.org>2018-09-28 23:29:42 +0200
commitfa56a17d517c2ba7438d140459148e19ee33f91c (patch)
tree9e3e9e8be3328198d17b62046f6d9d640c8a061f
parentf10cf4ae0ce997c77cd4aff5657d720a167ed0f7 (diff)
...
-rw-r--r--blinkstick.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/blinkstick.go b/blinkstick.go
index acf8a10..3188487 100644
--- a/blinkstick.go
+++ b/blinkstick.go
@@ -35,17 +35,17 @@ func SetIndex(w io.Writer, i int, c color.Color) {
func Set(w io.Writer, colors ...color.Color) error {
var buf []byte
- switch {
- case len(colors) <= 8:
+ switch l := len(colors); {
+ case l <= 8:
buf = make([]byte, 3*8+2)
buf[0] = 6
- case len(colors) <= 16:
+ case l <= 16:
buf = make([]byte, 3*16+2)
buf[0] = 7
- case len(colors) <= 32:
+ case l <= 32:
buf = make([]byte, 3*32+2)
buf[0] = 8
- case len(colors) <= 64:
+ case l <= 64:
buf = make([]byte, 3*64+2)
buf[0] = 9
default: