1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +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

@@ -101,7 +101,7 @@ func MembersAction(ctx *context.Context) {
err = models.RemoveOrgUser(org.ID, uid)
if organization.IsErrLastOrgOwner(err) {
ctx.Flash.Error(ctx.Tr("form.last_org_owner"))
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"redirect": ctx.Org.OrgLink + "/members",
})
return
@@ -110,12 +110,12 @@ func MembersAction(ctx *context.Context) {
err = models.RemoveOrgUser(org.ID, ctx.Doer.ID)
if err == nil {
ctx.Flash.Success(ctx.Tr("form.organization_leave_success", org.DisplayName()))
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"redirect": "", // keep the user stay on current page, in case they want to do other operations.
})
} else if organization.IsErrLastOrgOwner(err) {
ctx.Flash.Error(ctx.Tr("form.last_org_owner"))
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"redirect": ctx.Org.OrgLink + "/members",
})
} else {
@@ -126,7 +126,7 @@ func MembersAction(ctx *context.Context) {
if err != nil {
log.Error("Action(%s): %v", ctx.Params(":action"), err)
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"ok": false,
"err": err.Error(),
})
@@ -138,7 +138,7 @@ func MembersAction(ctx *context.Context) {
redirect = setting.AppSubURL + "/"
}
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"redirect": redirect,
})
}

View File

@@ -90,7 +90,7 @@ func DeleteLabel(ctx *context.Context) {
ctx.Flash.Success(ctx.Tr("repo.issues.label_deletion_success"))
}
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"redirect": ctx.Org.OrgLink + "/settings/labels",
})
}

View File

@@ -218,7 +218,7 @@ func DeleteProject(ctx *context.Context) {
ctx.Flash.Success(ctx.Tr("repo.projects.deletion_success"))
}
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"redirect": ctx.ContextUser.HomeLink() + "/-/projects",
})
}
@@ -449,7 +449,7 @@ func UpdateIssueProject(ctx *context.Context) {
}
}
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"ok": true,
})
}
@@ -497,7 +497,7 @@ func DeleteProjectBoard(ctx *context.Context) {
return
}
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"ok": true,
})
}
@@ -526,7 +526,7 @@ func AddBoardToProjectPost(ctx *context.Context) {
return
}
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"ok": true,
})
}
@@ -594,7 +594,7 @@ func EditProjectBoard(ctx *context.Context) {
return
}
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"ok": true,
})
}
@@ -611,7 +611,7 @@ func SetDefaultProjectBoard(ctx *context.Context) {
return
}
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"ok": true,
})
}
@@ -628,7 +628,7 @@ func UnsetDefaultProjectBoard(ctx *context.Context) {
return
}
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"ok": true,
})
}
@@ -730,7 +730,7 @@ func MoveIssues(ctx *context.Context) {
return
}
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"ok": true,
})
}

View File

@@ -224,7 +224,7 @@ func DeleteWebhook(ctx *context.Context) {
ctx.Flash.Success(ctx.Tr("repo.settings.webhook_deletion_success"))
}
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"redirect": ctx.Org.OrgLink + "/settings/hooks",
})
}

View File

@@ -79,7 +79,7 @@ func TeamsAction(ctx *context.Context) {
ctx.Flash.Error(ctx.Tr("form.last_org_owner"))
} else {
log.Error("Action(%s): %v", ctx.Params(":action"), err)
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"ok": false,
"err": err.Error(),
})
@@ -95,7 +95,7 @@ func TeamsAction(ctx *context.Context) {
redirect = setting.AppSubURL + "/"
}
ctx.JSON(http.StatusOK,
map[string]interface{}{
map[string]any{
"redirect": redirect,
})
return
@@ -117,7 +117,7 @@ func TeamsAction(ctx *context.Context) {
ctx.Flash.Error(ctx.Tr("form.last_org_owner"))
} else {
log.Error("Action(%s): %v", ctx.Params(":action"), err)
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"ok": false,
"err": err.Error(),
})
@@ -125,7 +125,7 @@ func TeamsAction(ctx *context.Context) {
}
}
ctx.JSON(http.StatusOK,
map[string]interface{}{
map[string]any{
"redirect": ctx.Org.OrgLink + "/teams/" + url.PathEscape(ctx.Org.Team.LowerName),
})
return
@@ -199,7 +199,7 @@ func TeamsAction(ctx *context.Context) {
ctx.Flash.Error(ctx.Tr("form.last_org_owner"))
} else {
log.Error("Action(%s): %v", ctx.Params(":action"), err)
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"ok": false,
"err": err.Error(),
})
@@ -256,7 +256,7 @@ func TeamsRepoAction(ctx *context.Context) {
}
if action == "addall" || action == "removeall" {
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"redirect": ctx.Org.OrgLink + "/teams/" + url.PathEscape(ctx.Org.Team.LowerName) + "/repositories",
})
return
@@ -414,7 +414,7 @@ func SearchTeam(ctx *context.Context) {
teams, maxResults, err := org_model.SearchTeam(opts)
if err != nil {
log.Error("SearchTeam failed: %v", err)
ctx.JSON(http.StatusInternalServerError, map[string]interface{}{
ctx.JSON(http.StatusInternalServerError, map[string]any{
"ok": false,
"error": "SearchTeam internal failure",
})
@@ -424,7 +424,7 @@ func SearchTeam(ctx *context.Context) {
apiTeams, err := convert.ToTeams(ctx, teams, false)
if err != nil {
log.Error("convert ToTeams failed: %v", err)
ctx.JSON(http.StatusInternalServerError, map[string]interface{}{
ctx.JSON(http.StatusInternalServerError, map[string]any{
"ok": false,
"error": "SearchTeam failed to get units",
})
@@ -432,7 +432,7 @@ func SearchTeam(ctx *context.Context) {
}
ctx.SetTotalCountHeader(maxResults)
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"ok": true,
"data": apiTeams,
})
@@ -530,7 +530,7 @@ func DeleteTeam(ctx *context.Context) {
ctx.Flash.Success(ctx.Tr("org.teams.delete_team_success"))
}
ctx.JSON(http.StatusOK, map[string]interface{}{
ctx.JSON(http.StatusOK, map[string]any{
"redirect": ctx.Org.OrgLink + "/teams",
})
}