diff --git a/Makefile b/Makefile index 246b270ab..95a439573 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,8 @@ lint: # TODO: fix lll issues # TODO: fix funlen issues # TODO: fix godox issues - ./bin/golangci-lint run --tests=false --enable-all --disable=lll --disable funlen --disable godox ./... + # TODO: fix wsl issues + ./bin/golangci-lint run --tests=false --enable-all --disable wsl --disable lll --disable funlen --disable godox ./... ./bin/misspell -error **/* .PHONY: lint diff --git a/internal/pipe/changelog/changelog.go b/internal/pipe/changelog/changelog.go index 8f6ae0fc8..17827e147 100644 --- a/internal/pipe/changelog/changelog.go +++ b/internal/pipe/changelog/changelog.go @@ -122,8 +122,8 @@ func sortEntries(ctx *context.Context, entries []string) []string { var result = make([]string, len(entries)) copy(result, entries) sort.Slice(result, func(i, j int) bool { - _, imsg := extractCommitInfo(result[i]) - _, jmsg := extractCommitInfo(result[j]) + var imsg = extractCommitInfo(result[i]) + var jmsg = extractCommitInfo(result[j]) if direction == "asc" { return strings.Compare(imsg, jmsg) < 0 } @@ -134,17 +134,15 @@ func sortEntries(ctx *context.Context, entries []string) []string { func remove(filter *regexp.Regexp, entries []string) (result []string) { for _, entry := range entries { - _, msg := extractCommitInfo(entry) - if !filter.MatchString(msg) { + if !filter.MatchString(extractCommitInfo(entry)) { result = append(result, entry) } } return result } -func extractCommitInfo(line string) (hash, msg string) { - ss := strings.Split(line, " ") - return ss[0], strings.Join(ss[1:], " ") +func extractCommitInfo(line string) string { + return strings.Join(strings.Split(line, " ")[1:], " ") } func getChangelog(tag string) (string, error) { diff --git a/internal/pipe/changelog/changelog_test.go b/internal/pipe/changelog/changelog_test.go index 8d3a3f406..5e3f20657 100644 --- a/internal/pipe/changelog/changelog_test.go +++ b/internal/pipe/changelog/changelog_test.go @@ -192,8 +192,7 @@ func TestChangelogSort(t *testing.T) { require.Len(t, entries, len(cfg.Entries)) var changes []string for _, line := range entries { - _, msg := extractCommitInfo(line) - changes = append(changes, msg) + changes = append(changes, extractCommitInfo(line)) } require.EqualValues(t, cfg.Entries, changes) })