Skip to content

Commit 844337c

Browse files
authored
refactor: replace Split in loops with more efficient SplitSeq (#4839)
Signed-off-by: efcking <efcking@outlook.com>
1 parent 401feb0 commit 844337c

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

ignite/services/chain/chain.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -587,8 +587,8 @@ func (c *Chain) parseAddressPrefix() (string, error) {
587587
}
588588

589589
// try to find the AccountAddressPrefix constant
590-
lines := strings.Split(string(content), "\n")
591-
for _, line := range lines {
590+
lines := strings.SplitSeq(string(content), "\n")
591+
for line := range lines {
592592
// match both formats:
593593
// AccountAddressPrefix = "cosmos"
594594
// AccountAddressPrefix string = "cosmos"
@@ -631,8 +631,8 @@ func (c *Chain) parseCoinType() (uint32, error) {
631631
}
632632

633633
// try to find the ChainCoinType constant
634-
lines := strings.Split(string(content), "\n")
635-
for _, line := range lines {
634+
lines := strings.SplitSeq(string(content), "\n")
635+
for line := range lines {
636636
if strings.Contains(line, "ChainCoinType") && strings.Contains(line, "=") {
637637
parts := strings.Split(line, "=")
638638
if len(parts) < 2 {

0 commit comments

Comments
 (0)