From fa56a17d517c2ba7438d140459148e19ee33f91c Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Fri, 28 Sep 2018 23:29:42 +0200 Subject: ... --- blinkstick.go | 10 +++++----- 1 file 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: -- cgit v1.2.3