1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-17 20:47:50 +02:00

ci: fix linter issues

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
This commit is contained in:
Carlos Alexandro Becker 2019-10-09 16:07:51 -03:00
parent 9423bb2abb
commit 21843b5a90
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
3 changed files with 8 additions and 10 deletions

View File

@ -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

View File

@ -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) {

View File

@ -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)
})