Skip to content

Commit ea83ca0

Browse files
refactor: change extractFileName param from []byte to string
1 parent a331ef7 commit ea83ca0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pkg/cmd/pr/diff/diff.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ func filterDiff(r io.Reader, excludePatterns []string) (io.Reader, error) {
397397

398398
var result bytes.Buffer
399399
for _, section := range splitDiffSections(string(data)) {
400-
name := extractFileName([]byte(section))
400+
name := extractFileName(section)
401401
if name != "" && matchesAny(name, excludePatterns) {
402402
continue
403403
}
@@ -428,12 +428,12 @@ func splitDiffSections(diff string) []string {
428428
return sections
429429
}
430430

431-
func extractFileName(section []byte) string {
432-
m := diffHeaderRegexp.FindSubmatch(section)
431+
func extractFileName(section string) string {
432+
m := diffHeaderRegexp.FindStringSubmatch(section)
433433
if m == nil {
434434
return ""
435435
}
436-
return strings.TrimSpace(string(m[1]) + string(m[2]))
436+
return strings.TrimSpace(m[1] + m[2])
437437
}
438438

439439
func matchesAny(name string, excludePatterns []string) bool {

0 commit comments

Comments
 (0)