diff options
author | Joe Chen <jc@unknwon.io> | 2023-02-02 21:25:25 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-02 21:25:25 +0800 |
commit | c53a1998c589a544b25d53f6e6fdf0f24a4df25b (patch) | |
tree | 1c3c9d693ba551eecfbc535be942e40b5acf9cf7 /internal/route/admin | |
parent | 614382fec0ba05149785539ab93560d4d42c194d (diff) |
all: replace `interface{}` with `any` (#7330)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Diffstat (limited to 'internal/route/admin')
-rw-r--r-- | internal/route/admin/auths.go | 8 | ||||
-rw-r--r-- | internal/route/admin/repos.go | 2 | ||||
-rw-r--r-- | internal/route/admin/users.go | 6 |
3 files changed, 8 insertions, 8 deletions
diff --git a/internal/route/admin/auths.go b/internal/route/admin/auths.go index 49839dae..a19888bb 100644 --- a/internal/route/admin/auths.go +++ b/internal/route/admin/auths.go @@ -47,7 +47,7 @@ func Authentications(c *context.Context) { type dropdownItem struct { Name string - Type interface{} + Type any } var ( @@ -130,7 +130,7 @@ func NewAuthSourcePost(c *context.Context, f form.Authentication) { c.Data["SMTPAuths"] = smtp.AuthTypes hasTLS := false - var config interface{} + var config any switch auth.Type(f.Type) { case auth.LDAP, auth.DLDAP: config = parseLDAPConfig(f) @@ -284,7 +284,7 @@ func DeleteAuthSource(c *context.Context) { } else { c.Flash.Error(fmt.Sprintf("DeleteSource: %v", err)) } - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "redirect": conf.Server.Subpath + "/admin/auths/" + c.Params(":authid"), }) return @@ -292,7 +292,7 @@ func DeleteAuthSource(c *context.Context) { log.Trace("Authentication deleted by admin(%s): %d", c.User.Name, id) c.Flash.Success(c.Tr("admin.auths.deletion_success")) - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "redirect": conf.Server.Subpath + "/admin/auths", }) } diff --git a/internal/route/admin/repos.go b/internal/route/admin/repos.go index c2d2509c..5ae8f749 100644 --- a/internal/route/admin/repos.go +++ b/internal/route/admin/repos.go @@ -81,7 +81,7 @@ func DeleteRepo(c *context.Context) { log.Trace("Repository deleted: %s/%s", repo.MustOwner().Name, repo.Name) c.Flash.Success(c.Tr("repo.settings.deletion_success")) - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "redirect": conf.Server.Subpath + "/admin/repos?page=" + c.Query("page"), }) } diff --git a/internal/route/admin/users.go b/internal/route/admin/users.go index 9b47b5fc..1b49d216 100644 --- a/internal/route/admin/users.go +++ b/internal/route/admin/users.go @@ -230,12 +230,12 @@ func DeleteUser(c *context.Context) { switch { case db.IsErrUserOwnRepos(err): c.Flash.Error(c.Tr("admin.users.still_own_repo")) - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "redirect": conf.Server.Subpath + "/admin/users/" + c.Params(":userid"), }) case db.IsErrUserHasOrgs(err): c.Flash.Error(c.Tr("admin.users.still_has_org")) - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "redirect": conf.Server.Subpath + "/admin/users/" + c.Params(":userid"), }) default: @@ -246,7 +246,7 @@ func DeleteUser(c *context.Context) { log.Trace("Account deleted by admin (%s): %s", c.User.Name, u.Name) c.Flash.Success(c.Tr("admin.users.deletion_success")) - c.JSONSuccess(map[string]interface{}{ + c.JSONSuccess(map[string]any{ "redirect": conf.Server.Subpath + "/admin/users", }) } |