aboutsummaryrefslogtreecommitdiff
path: root/lib/ini/section.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/ini/section.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/ini/section.go')
-rw-r--r--lib/ini/section.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/ini/section.go b/lib/ini/section.go
index 70b64a9b..7859f961 100644
--- a/lib/ini/section.go
+++ b/lib/ini/section.go
@@ -1,6 +1,6 @@
-// Copyright 2018, 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: 2018 M. Shulhan <ms@kilabit.info>
+//
+// SPDX-License-Identifier: BSD-3-Clause
package ini
@@ -108,7 +108,7 @@ func (sec *Section) add(key, value string) bool {
keyLower := strings.ToLower(key)
idx := -1
- for x := 0; x < len(sec.vars); x++ {
+ for x := range len(sec.vars) {
if !isLineModeVar(sec.vars[x].mode) {
continue
}
@@ -144,7 +144,7 @@ func (sec *Section) add(key, value string) bool {
// list.
func (sec *Section) addUniqValue(key, value string) {
keyLower := strings.ToLower(key)
- for x := 0; x < len(sec.vars); x++ {
+ for x := range len(sec.vars) {
if sec.vars[x].keyLower == keyLower {
if sec.vars[x].value == value {
tmp := sec.vars[x]
@@ -244,7 +244,7 @@ func (sec *Section) gets(key string, defs []string) (vals []string, ok bool) {
}
key = strings.ToLower(key)
- for x := 0; x < len(sec.vars); x++ {
+ for x := range len(sec.vars) {
if sec.vars[x].keyLower == key {
vals = append(vals, sec.vars[x].value)
}
@@ -258,7 +258,7 @@ func (sec *Section) gets(key string, defs []string) (vals []string, ok bool) {
// merge other Section variables on this section, ignoring empty or comment
// mode.
func (sec *Section) merge(other *Section) {
- for x := 0; x < len(other.vars); x++ {
+ for x := range len(other.vars) {
if !isLineModeVar(other.vars[x].mode) {
continue
}
@@ -346,7 +346,7 @@ func (sec *Section) unsetAll(key string) {
vars := make([]*variable, 0, len(sec.vars))
key = strings.ToLower(key)
- for x := 0; x < len(sec.vars); x++ {
+ for x := range len(sec.vars) {
if sec.vars[x].keyLower != key {
// Ignore the last empty line.
if x == len(sec.vars)-1 &&