Replace interface{} with any (#25686) (#25687)

Same perl replacement as https://github.com/go-gitea/gitea/pull/25686
but for 1.20 to ease future backporting.
This commit is contained in:
silverwind 2023-07-05 05:41:32 +02:00 committed by GitHub
parent 4e310133f9
commit 24e64fe372
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
233 changed files with 729 additions and 729 deletions

View file

@ -946,7 +946,7 @@ func renderErrorOfTemplates(ctx *context.Context, errs map[string]error) string
lines = append(lines, fmt.Sprintf("%s: %v", file, errs[file]))
}
flashError, err := ctx.RenderToString(tplAlertDetails, map[string]interface{}{
flashError, err := ctx.RenderToString(tplAlertDetails, map[string]any{
"Message": ctx.Tr("repo.issues.choose.ignore_invalid_templates"),
"Summary": ctx.Tr("repo.issues.choose.invalid_templates", len(errs)),
"Details": utils.SanitizeFlashErrorString(strings.Join(lines, "\n")),
@ -2062,7 +2062,7 @@ func UpdateIssueTitle(ctx *context.Context) {
return
}
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"title": issue.Title,
})
}
@ -2086,7 +2086,7 @@ func UpdateIssueRef(ctx *context.Context) {
return
}
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"ref": ref,
})
}
@ -2127,7 +2127,7 @@ func UpdateIssueContent(ctx *context.Context) {
return
}
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"content": content,
"attachments": attachmentsHTML(ctx, issue.Attachments, issue.Content),
})
@ -2187,7 +2187,7 @@ func UpdateIssueMilestone(ctx *context.Context) {
}
}
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"ok": true,
})
}
@ -2233,7 +2233,7 @@ func UpdateIssueAssignee(ctx *context.Context) {
}
}
}
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"ok": true,
})
}
@ -2358,7 +2358,7 @@ func UpdatePullReviewRequest(ctx *context.Context) {
}
}
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"ok": true,
})
}
@ -2730,7 +2730,7 @@ func UpdateIssueStatus(ctx *context.Context) {
if issue.IsClosed != isClosed {
if err := issue_service.ChangeStatus(issue, ctx.Doer, "", isClosed); err != nil {
if issues_model.IsErrDependenciesLeft(err) {
ctx.JSON(http.StatusPreconditionFailed, map[string]interface{}{
ctx.JSON(http.StatusPreconditionFailed, map[string]any{
"error": ctx.Tr("repo.issues.dependency.issue_batch_close_blocked", issue.Index),
})
return
@ -2740,7 +2740,7 @@ func UpdateIssueStatus(ctx *context.Context) {
}
}
}
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"ok": true,
})
}
@ -2954,7 +2954,7 @@ func UpdateCommentContent(ctx *context.Context) {
oldContent := comment.Content
comment.Content = ctx.FormString("content")
if len(comment.Content) == 0 {
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"content": "",
})
return
@ -2988,7 +2988,7 @@ func UpdateCommentContent(ctx *context.Context) {
return
}
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"content": content,
"attachments": attachmentsHTML(ctx, comment.Attachments, comment.Content),
})
@ -3098,14 +3098,14 @@ func ChangeIssueReaction(ctx *context.Context) {
}
if len(issue.Reactions) == 0 {
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"empty": true,
"html": "",
})
return
}
html, err := ctx.RenderToString(tplReactions, map[string]interface{}{
html, err := ctx.RenderToString(tplReactions, map[string]any{
"ctxData": ctx.Data,
"ActionURL": fmt.Sprintf("%s/issues/%d/reactions", ctx.Repo.RepoLink, issue.Index),
"Reactions": issue.Reactions.GroupByType(),
@ -3114,7 +3114,7 @@ func ChangeIssueReaction(ctx *context.Context) {
ctx.ServerError("ChangeIssueReaction.HTMLString", err)
return
}
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"html": html,
})
}
@ -3200,14 +3200,14 @@ func ChangeCommentReaction(ctx *context.Context) {
}
if len(comment.Reactions) == 0 {
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"empty": true,
"html": "",
})
return
}
html, err := ctx.RenderToString(tplReactions, map[string]interface{}{
html, err := ctx.RenderToString(tplReactions, map[string]any{
"ctxData": ctx.Data,
"ActionURL": fmt.Sprintf("%s/comments/%d/reactions", ctx.Repo.RepoLink, comment.ID),
"Reactions": comment.Reactions.GroupByType(),
@ -3216,7 +3216,7 @@ func ChangeCommentReaction(ctx *context.Context) {
ctx.ServerError("ChangeCommentReaction.HTMLString", err)
return
}
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"html": html,
})
}
@ -3289,7 +3289,7 @@ func GetCommentAttachments(ctx *context.Context) {
ctx.JSON(http.StatusOK, attachments)
}
func updateAttachments(ctx *context.Context, item interface{}, files []string) error {
func updateAttachments(ctx *context.Context, item any, files []string) error {
var attachments []*repo_model.Attachment
switch content := item.(type) {
case *issues_model.Issue:
@ -3333,7 +3333,7 @@ func updateAttachments(ctx *context.Context, item interface{}, files []string) e
}
func attachmentsHTML(ctx *context.Context, attachments []*repo_model.Attachment, content string) string {
attachHTML, err := ctx.RenderToString(tplAttachment, map[string]interface{}{
attachHTML, err := ctx.RenderToString(tplAttachment, map[string]any{
"ctxData": ctx.Data,
"Attachments": attachments,
"Content": content,