aboutsummaryrefslogtreecommitdiff
path: root/lib/hunspell/flags.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2025-01-23 03:40:50 +0700
committerShulhan <ms@kilabit.info>2025-01-23 03:41:10 +0700
commit2a0694d2fa577574b505c4635eb8a824eaf88ddc (patch)
treecce840739c7f59893c3a6a65a1600f9f857c484e /lib/hunspell/flags.go
parent605d847b236dde031a2e387e74298d66a27b5e0a (diff)
downloadpakakeh.go-2a0694d2fa577574b505c4635eb8a824eaf88ddc.tar.xz
all: use for-range with numeric
Go 1.22 now support for-range on numeric value.
Diffstat (limited to 'lib/hunspell/flags.go')
-rw-r--r--lib/hunspell/flags.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/hunspell/flags.go b/lib/hunspell/flags.go
index 7324e1cf..1c725b6d 100644
--- a/lib/hunspell/flags.go
+++ b/lib/hunspell/flags.go
@@ -1,6 +1,6 @@
-// Copyright 2019, Shulhan <ms@kilabit.info>. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
+// SPDX-FileCopyrightText: 2019 M. Shulhan <ms@kilabit.info>
+//
+// SPDX-License-Identifier: BSD-3-Clause
package hunspell
@@ -32,7 +32,7 @@ func unpackFlags(ftype, rawflags string) (flags []string, err error) {
}
func unpackFlagASCII(f string) (flags []string) {
- for x := 0; x < len(f); x++ {
+ for x := range len(f) {
flags = append(flags, string(f[x]))
}
return
@@ -49,7 +49,8 @@ func unpackFlagLong(f string) (flags []string, err error) {
if len(f)%2 != 0 {
return nil, fmt.Errorf("invalid long flags: %q", f)
}
- for x := 0; x < len(f); x += 2 {
+ var x int
+ for ; x < len(f); x += 2 {
flags = append(flags, f[x:x+2])
}
return
@@ -59,7 +60,7 @@ func unpackFlagNum(f string) (flags []string, err error) {
flags = strings.Split(f, ",")
// Trim spaces and check if all the flags is valid number.
- for x := 0; x < len(flags); x++ {
+ for x := range len(flags) {
flags[x] = strings.TrimSpace(flags[x])
_, err = strconv.Atoi(flags[x])