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/context/context.go | |
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/context/context.go')
-rw-r--r-- | internal/context/context.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/context/context.go b/internal/context/context.go index b9c8242a..69a34dd4 100644 --- a/internal/context/context.go +++ b/internal/context/context.go @@ -138,7 +138,7 @@ func (c *Context) Success(name string) { } // JSONSuccess responses JSON with status http.StatusOK. -func (c *Context) JSONSuccess(data interface{}) { +func (c *Context) JSONSuccess(data any) { c.JSON(http.StatusOK, data) } @@ -160,7 +160,7 @@ func (c *Context) RedirectSubpath(location string, status ...int) { } // RenderWithErr used for page has form validation but need to prompt error to users. -func (c *Context) RenderWithErr(msg, tpl string, f interface{}) { +func (c *Context) RenderWithErr(msg, tpl string, f any) { if f != nil { form.Assign(f, c.Data) } @@ -189,7 +189,7 @@ func (c *Context) Error(err error, msg string) { } // Errorf renders the 500 response with formatted message. -func (c *Context) Errorf(err error, format string, args ...interface{}) { +func (c *Context) Errorf(err error, format string, args ...any) { c.Error(err, fmt.Sprintf(format, args...)) } @@ -203,7 +203,7 @@ func (c *Context) NotFoundOrError(err error, msg string) { } // NotFoundOrErrorf is same as NotFoundOrError but with formatted message. -func (c *Context) NotFoundOrErrorf(err error, format string, args ...interface{}) { +func (c *Context) NotFoundOrErrorf(err error, format string, args ...any) { c.NotFoundOrError(err, fmt.Sprintf(format, args...)) } @@ -211,7 +211,7 @@ func (c *Context) PlainText(status int, msg string) { c.Render.PlainText(status, []byte(msg)) } -func (c *Context) ServeContent(name string, r io.ReadSeeker, params ...interface{}) { +func (c *Context) ServeContent(name string, r io.ReadSeeker, params ...any) { modtime := time.Now() for _, p := range params { switch v := p.(type) { |