From 2a0694d2fa577574b505c4635eb8a824eaf88ddc Mon Sep 17 00:00:00 2001 From: Shulhan Date: Thu, 23 Jan 2025 03:40:50 +0700 Subject: all: use for-range with numeric Go 1.22 now support for-range on numeric value. --- lib/strings/table.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib/strings/table.go') diff --git a/lib/strings/table.go b/lib/strings/table.go index 21e25e28..9e9f8d6f 100644 --- a/lib/strings/table.go +++ b/lib/strings/table.go @@ -1,6 +1,6 @@ -// Copyright 2018, Shulhan . 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 +// +// SPDX-License-Identifier: BSD-3-Clause package strings @@ -78,7 +78,7 @@ func SinglePartition(ss []string) Table { table := make(Table, 0) row := make(Row, len(ss)) - for x := 0; x < len(ss); x++ { + for x := range len(ss) { row[x] = []string{ss[x]} } @@ -97,8 +97,8 @@ func (table Table) IsEqual(other Table) bool { check := make([]bool, len(table)) - for x := 0; x < len(table); x++ { - for y := 0; y < len(other); y++ { + for x := range len(table) { + for y := range len(other) { if table[x].IsEqual(other[y]) { check[x] = true break @@ -118,7 +118,7 @@ func (table Table) IsEqual(other Table) bool { // different record in different new row. func (table Table) JoinCombination(s string) (tout Table) { for _, row := range table { - for y := 0; y < len(row); y++ { + for y := range len(row) { newRow := make(Row, len(row)) copy(newRow, row) newRow[y] = append(newRow[y], s) -- cgit v1.3