Skip to content

Commit

Permalink
chore(results): remove risky slice access
Browse files Browse the repository at this point in the history
  • Loading branch information
bostrt committed Jun 30, 2022
1 parent 9532465 commit c740eea
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pkg/results/results.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,13 @@ func SaveToResultsFile(names []string) error {
}
}()

for _, n := range names {
_, err = output.WriteString(n + ";")
for i, n := range names {
outputStr := n
if i < len(names)-1 {
// don't include semicolon on last entry
outputStr += ";"
}
_, err = output.WriteString(outputStr)
if err != nil {
return err
}
Expand All @@ -93,9 +98,5 @@ func GetResultFileNames() ([]string, error) {
return results, err
}
splitInput := strings.Split(string(contents), ";")
// Remove trailing empty string
if len(splitInput) > 1 {
splitInput = splitInput[:len(splitInput)-1]
}
return splitInput, nil
}

0 comments on commit c740eea

Please sign in to comment.