Skip to content

Commit

Permalink
fix(changelog): invalid index access
Browse files Browse the repository at this point in the history
Fix invalid invalid index access in changelog processing when removing
processed items.
  • Loading branch information
stevenh committed Nov 7, 2022
1 parent 01bbd38 commit dd73294
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions internal/pipe/changelog/changelog.go
Expand Up @@ -157,15 +157,19 @@ func formatChangelog(ctx *context.Context, entries []string) (string, error) {
}

log.Debugf("group: %#v", group)
for i, entry := range entries {
i := 0
for _, entry := range entries {
match := regex.MatchString(entry)
log.Debugf("match[%d]: %s = %v\n", i, entry, match)
log.Debugf("entry: %s match: %b\n", entry, match)
if match {
item.entries = append(item.entries, li+entry)
// Remove matched entry.
entries = append(entries[:i], entries[i+1:]...)
} else {
// Keep unmatched entry.
entries[i] = entry
i++
}
}
entries = entries[:i]
}
groups = append(groups, item)

Expand Down

0 comments on commit dd73294

Please sign in to comment.