1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-23 02:38:35 +00:00

Replace interface{} with any (#25686)

Result of running `perl -p -i -e 's#interface\{\}#any#g' **/*` and `make fmt`.

Basically the same [as golang did](2580d0e08d).
This commit is contained in:
silverwind
2023-07-04 20:36:08 +02:00
committed by GitHub
parent 00dbba7f42
commit 88f835192d
233 changed files with 727 additions and 727 deletions

View File

@@ -952,7 +952,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")),
@@ -2081,7 +2081,7 @@ func UpdateIssueTitle(ctx *context.Context) {
return
}
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"title": issue.Title,
})
}
@@ -2105,7 +2105,7 @@ func UpdateIssueRef(ctx *context.Context) {
return
}
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"ref": ref,
})
}
@@ -2146,7 +2146,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),
})
@@ -2206,7 +2206,7 @@ func UpdateIssueMilestone(ctx *context.Context) {
}
}
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"ok": true,
})
}
@@ -2252,7 +2252,7 @@ func UpdateIssueAssignee(ctx *context.Context) {
}
}
}
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"ok": true,
})
}
@@ -2377,7 +2377,7 @@ func UpdatePullReviewRequest(ctx *context.Context) {
}
}
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"ok": true,
})
}
@@ -2763,7 +2763,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
@@ -2978,7 +2978,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
@@ -3012,7 +3012,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),
})
@@ -3122,14 +3122,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(),
@@ -3138,7 +3138,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,
})
}
@@ -3224,14 +3224,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(),
@@ -3240,7 +3240,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,
})
}
@@ -3313,7 +3313,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:
@@ -3357,7 +3357,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,