Bump golangci-lint to 2.7.2, enable modernize stringsbuilder (#36180)

Fixes were done automatically by `make lint-go-fix`. These modernize
fixes are very readable.

Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
silverwind
2025-12-17 21:50:53 +01:00
committed by GitHub
parent ebf9b4dc6b
commit 1e22bd712f
16 changed files with 67 additions and 63 deletions

View File

@@ -173,18 +173,19 @@ func (m matrixConvertor) Push(p *api.PushPayload) (MatrixPayload, error) {
repoLink := htmlLinkFormatter(p.Repo.HTMLURL, p.Repo.FullName)
branchLink := MatrixLinkToRef(p.Repo.HTMLURL, p.Ref)
text := fmt.Sprintf("[%s] %s pushed %s to %s:<br>", repoLink, p.Pusher.UserName, commitDesc, branchLink)
var text strings.Builder
text.WriteString(fmt.Sprintf("[%s] %s pushed %s to %s:<br>", repoLink, p.Pusher.UserName, commitDesc, branchLink))
// for each commit, generate a new line text
for i, commit := range p.Commits {
text += fmt.Sprintf("%s: %s - %s", htmlLinkFormatter(commit.URL, commit.ID[:7]), commit.Message, commit.Author.Name)
text.WriteString(fmt.Sprintf("%s: %s - %s", htmlLinkFormatter(commit.URL, commit.ID[:7]), commit.Message, commit.Author.Name))
// add linebreak to each commit but the last
if i < len(p.Commits)-1 {
text += "<br>"
text.WriteString("<br>")
}
}
return m.newPayload(text, p.Commits...)
return m.newPayload(text.String(), p.Commits...)
}
// PullRequest implements payloadConvertor PullRequest method