Skip to content

Commit 279a0cd

Browse files
committed
refactor: replace Split in loops with more efficient SplitSeq
Signed-off-by: moveyield <moveyield@outlook.com>
1 parent adf6d32 commit 279a0cd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

utils/cli_helpers.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const (
1616

1717
func ParseUint64SliceFromString(s, separator string) ([]uint64, error) {
1818
var parsedInts []uint64
19-
for _, s := range strings.Split(s, separator) {
19+
for s := range strings.SplitSeq(s, separator) {
2020
s = strings.TrimSpace(s)
2121

2222
parsed, err := strconv.ParseUint(s, base, bitlen)
@@ -30,7 +30,7 @@ func ParseUint64SliceFromString(s, separator string) ([]uint64, error) {
3030

3131
func ParseSdkIntFromString(s, separator string) ([]math.Int, error) {
3232
var parsedInts []math.Int
33-
for _, weightStr := range strings.Split(s, separator) {
33+
for weightStr := range strings.SplitSeq(s, separator) {
3434
weightStr = strings.TrimSpace(weightStr)
3535

3636
parsed, err := strconv.ParseUint(weightStr, base, bitlen)
@@ -44,7 +44,7 @@ func ParseSdkIntFromString(s, separator string) ([]math.Int, error) {
4444

4545
func ParseSdkDecFromString(s, separator string) ([]math.LegacyDec, error) {
4646
var parsedDec []math.LegacyDec
47-
for _, weightStr := range strings.Split(s, separator) {
47+
for weightStr := range strings.SplitSeq(s, separator) {
4848
weightStr = strings.TrimSpace(weightStr)
4949

5050
parsed, err := math.LegacyNewDecFromStr(weightStr)

0 commit comments

Comments
 (0)