Skip to content

Commit 9759071

Browse files
authored
Merge pull request #1094 from criciss/master
refactor: use slices.Backward to simplify the code
2 parents a6d9a9c + 22e9ef3 commit 9759071

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

shared/services/proposals/checksum-manager.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"fmt"
88
"os"
99
"path/filepath"
10+
"slices"
1011
"sort"
1112
"strings"
1213

@@ -138,9 +139,7 @@ func LoadFromFile[ContextType any, DataType IDataType](m *ChecksumManager[Contex
138139

139140
// Iterate over each file, counting backwards from the bottom
140141
dataFolder := filepath.Dir(m.checksumFilename)
141-
for i := len(lines) - 1; i >= 0; i-- {
142-
line := lines[i]
143-
142+
for _, line := range slices.Backward(lines) {
144143
// Get the checksum from the line
145144
checksumString, filename, found := strings.Cut(line, " ")
146145
if !found {

0 commit comments

Comments
 (0)