fix: modify interface check way (#3327)

This commit is contained in:
Jesse 2022-10-20 00:49:19 +08:00 committed by GitHub
parent 33ab0fc155
commit 51aea73ba0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 6 additions and 6 deletions

View File

@ -43,7 +43,7 @@ func (err SliceValidationError) Error() string {
}
}
var _ StructValidator = &defaultValidator{}
var _ StructValidator = (*defaultValidator)(nil)
// ValidateStruct receives any kind of type, but only performed struct or pointer to struct type.
func (v *defaultValidator) ValidateStruct(obj any) error {

View File

@ -30,7 +30,7 @@ import (
"google.golang.org/protobuf/proto"
)
var _ context.Context = &Context{}
var _ context.Context = (*Context)(nil)
// Unit tests TODO
// func (c *Context) File(filepath string) {

View File

@ -39,7 +39,7 @@ type Error struct {
type errorMsgs []*Error
var _ error = &Error{}
var _ error = (*Error)(nil)
// SetType sets the error's type.
func (msg *Error) SetType(flags ErrorType) *Error {

2
gin.go
View File

@ -166,7 +166,7 @@ type Engine struct {
trustedCIDRs []*net.IPNet
}
var _ IRouter = &Engine{}
var _ IRouter = (*Engine)(nil)
// New returns a new blank Engine instance without any middleware attached.
// By default, the configuration is:

View File

@ -49,7 +49,7 @@ type responseWriter struct {
status int
}
var _ ResponseWriter = &responseWriter{}
var _ ResponseWriter = (*responseWriter)(nil)
func (w *responseWriter) reset(writer http.ResponseWriter) {
w.ResponseWriter = writer

View File

@ -58,7 +58,7 @@ type RouterGroup struct {
root bool
}
var _ IRouter = &RouterGroup{}
var _ IRouter = (*RouterGroup)(nil)
// Use adds middleware to the group, see example code in GitHub.
func (group *RouterGroup) Use(middleware ...HandlerFunc) IRoutes {