fix pass []any as any in variadic function by asasalint (#5012)

* fix pass []any as any in variadic function

* add change log
This commit is contained in:
alingse 2022-07-10 14:39:46 +08:00 committed by GitHub
parent 493e7db20b
commit 890caddfb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 7 additions and 6 deletions

View File

@ -2,6 +2,7 @@
- [Fix 4984: random expire cache](https://github.com/beego/beego/pull/4984)
- [Fix 4907: make admin serve HTTP only](https://github.com/beego/beego/pull/5005)
- [Feat 4999: add get all tasks function](https://github.com/beego/beego/pull/4999)
- [Fix 5012: fix some bug, pass []any as any in variadic function](https://github.com/beego/beego/pull/5012)
# v2.0.4

View File

@ -245,7 +245,7 @@ func Any(rootpath string, f FilterFunc) *App {
// fmt.Fprintf(w, "Hello, %q", html.EscapeString(r.URL.Path))
// }))
func Handler(rootpath string, h http.Handler, options ...interface{}) *App {
return (*App)(web.Handler(rootpath, h, options))
return (*App)(web.Handler(rootpath, h, options...))
}
// InsertFilter adds a FilterFunc with pattern condition and action constant.

View File

@ -78,7 +78,7 @@ func (ctx *Context) GetCookie(key string) string {
// SetCookie Set cookie for response.
// It's alias of BeegoOutput.Cookie.
func (ctx *Context) SetCookie(name string, value string, others ...interface{}) {
(*context.Context)(ctx).SetCookie(name, value, others)
(*context.Context)(ctx).SetCookie(name, value, others...)
}
// GetSecureCookie Get secure cookie from request by a given key.
@ -88,7 +88,7 @@ func (ctx *Context) GetSecureCookie(Secret, key string) (string, bool) {
// SetSecureCookie Set Secure cookie for response.
func (ctx *Context) SetSecureCookie(Secret, name, value string, others ...interface{}) {
(*context.Context)(ctx).SetSecureCookie(Secret, name, value, others)
(*context.Context)(ctx).SetSecureCookie(Secret, name, value, others...)
}
// XSRFToken creates a xsrf token string and returns.

View File

@ -47,7 +47,7 @@ func (output *BeegoOutput) Body(content []byte) error {
// Cookie sets cookie value via given key.
// others are ordered as cookie's max age time, path,domain, secure and httponly.
func (output *BeegoOutput) Cookie(name string, value string, others ...interface{}) {
(*context.BeegoOutput)(output).Cookie(name, value, others)
(*context.BeegoOutput)(output).Cookie(name, value, others...)
}
// JSON writes json to response body.

View File

@ -69,7 +69,7 @@ func (d *DB) QueryContext(ctx context.Context, query string, args ...interface{}
}
func (d *DB) QueryRow(query string, args ...interface{}) *sql.Row {
return (*orm.DB)(d).QueryRow(query, args)
return (*orm.DB)(d).QueryRow(query, args...)
}
func (d *DB) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row {

View File

@ -212,7 +212,7 @@ func (p *ControllerRegister) AddMethod(method, pattern string, f FilterFunc) {
// Handler add user defined Handler
func (p *ControllerRegister) Handler(pattern string, h http.Handler, options ...interface{}) {
(*web.ControllerRegister)(p).Handler(pattern, h, options)
(*web.ControllerRegister)(p).Handler(pattern, h, options...)
}
// AddAuto router to ControllerRegister.