summaryrefslogtreecommitdiff
path: root/util.go
diff options
context:
space:
mode:
authorVeselkov Konstantin <kostozyb@gmail.com>2018-09-15 21:23:36 +0400
committerKurt Jung <kurt.w.jung@gmail.com>2018-09-15 13:23:36 -0400
commit7d57599b9d9c5fb48ea733596cbb812d7f84a8d6 (patch)
tree5c4b8a4ffd2fa420877bed0aea4eecc789316af0 /util.go
parent964b1221fa545d09ad62569f58a94dbbadaad57c (diff)
fixed warnings gocritic 3.3 (#192)
Diffstat (limited to 'util.go')
-rw-r--r--util.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/util.go b/util.go
index 746bca6..0e89bbe 100644
--- a/util.go
+++ b/util.go
@@ -114,7 +114,8 @@ func utf8toutf16(s string) string {
for i < nb {
c1 := byte(s[i])
i++
- if c1 >= 224 {
+ switch {
+ case c1 >= 224:
// 3-byte character
c2 := byte(s[i])
i++
@@ -122,13 +123,13 @@ func utf8toutf16(s string) string {
i++
res = append(res, ((c1&0x0F)<<4)+((c2&0x3C)>>2),
((c2&0x03)<<6)+(c3&0x3F))
- } else if c1 >= 192 {
+ case c1 >= 192:
// 2-byte character
c2 := byte(s[i])
i++
res = append(res, ((c1 & 0x1C) >> 2),
((c1&0x03)<<6)+(c2&0x3F))
- } else {
+ default:
// Single-byte character
res = append(res, 0, c1)
}