mirror of
https://github.com/kataras/iris.git
synced 2026-01-10 05:25:58 +00:00
CI: minor: use the new exclude-paths (dependabot PR approved some days ago)
This commit is contained in:
@@ -101,16 +101,16 @@ func TestContainerInject(t *testing.T) {
|
||||
func TestContainerUseResultHandler(t *testing.T) {
|
||||
c := New()
|
||||
resultLogger := func(next ResultHandler) ResultHandler {
|
||||
return func(ctx iris.Context, v interface{}) error {
|
||||
return func(ctx iris.Context, v any) error {
|
||||
t.Logf("%#+v", v)
|
||||
return next(ctx, v)
|
||||
}
|
||||
}
|
||||
|
||||
c.UseResultHandler(resultLogger)
|
||||
expectedResponse := map[string]interface{}{"injected": true}
|
||||
expectedResponse := map[string]any{"injected": true}
|
||||
c.UseResultHandler(func(next ResultHandler) ResultHandler {
|
||||
return func(ctx iris.Context, v interface{}) error {
|
||||
return func(ctx iris.Context, v any) error {
|
||||
return next(ctx, expectedResponse)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -24,7 +24,7 @@ type (
|
||||
// Contains its source location, the dependency handler (provider) itself and information
|
||||
// such as static for static struct values or explicit to bind a value to its exact DestType and not if just assignable to it (interfaces).
|
||||
Dependency struct {
|
||||
OriginalValue interface{} // Used for debugging and for logging only.
|
||||
OriginalValue any // Used for debugging and for logging only.
|
||||
Source Source
|
||||
Handle DependencyHandler
|
||||
// It's the exact type of return to bind, if declared to return <T>, otherwise nil.
|
||||
@@ -75,12 +75,12 @@ func (d *Dependency) String() string {
|
||||
// NewDependency converts a function or a function which accepts other dependencies or static struct value to a *Dependency.
|
||||
//
|
||||
// See `Container.Handler` for more.
|
||||
func NewDependency(dependency interface{}, funcDependencies ...*Dependency) *Dependency { // used only on tests.
|
||||
func NewDependency(dependency any, funcDependencies ...*Dependency) *Dependency { // used only on tests.
|
||||
return newDependency(dependency, false, false, nil, funcDependencies...)
|
||||
}
|
||||
|
||||
func newDependency(
|
||||
dependency interface{},
|
||||
dependency any,
|
||||
disablePayloadAutoBinding bool,
|
||||
enableStructDependents bool,
|
||||
matchDependency DependencyMatcher,
|
||||
|
||||
@@ -11,8 +11,8 @@ import (
|
||||
)
|
||||
|
||||
type testDependencyTest struct {
|
||||
Dependency interface{}
|
||||
Expected interface{}
|
||||
Dependency any
|
||||
Expected any
|
||||
}
|
||||
|
||||
func TestDependency(t *testing.T) {
|
||||
@@ -66,14 +66,14 @@ func TestDependency(t *testing.T) {
|
||||
},
|
||||
{
|
||||
|
||||
Dependency: func(*context.Context) interface{} {
|
||||
Dependency: func(*context.Context) any {
|
||||
return "1"
|
||||
},
|
||||
Expected: "1",
|
||||
},
|
||||
{
|
||||
|
||||
Dependency: func(*context.Context) interface{} {
|
||||
Dependency: func(*context.Context) any {
|
||||
return false
|
||||
},
|
||||
Expected: false,
|
||||
|
||||
@@ -11,9 +11,9 @@ import (
|
||||
)
|
||||
|
||||
// ResultHandler describes the function type which should serve the "v" struct value.
|
||||
type ResultHandler func(ctx *context.Context, v interface{}) error
|
||||
type ResultHandler func(ctx *context.Context, v any) error
|
||||
|
||||
func defaultResultHandler(ctx *context.Context, v interface{}) error {
|
||||
func defaultResultHandler(ctx *context.Context, v any) error {
|
||||
if p, ok := v.(PreflightResult); ok {
|
||||
if err := p.Preflight(ctx); err != nil {
|
||||
return err
|
||||
@@ -183,7 +183,7 @@ func dispatchFuncResult(ctx *context.Context, values []reflect.Value, handler Re
|
||||
// if not nil then check
|
||||
// for content type (or json default) and send the custom data object
|
||||
// except when found == false or err != nil.
|
||||
custom interface{}
|
||||
custom any
|
||||
// if false then skip everything and fire 404.
|
||||
found = true // defaults to true of course, otherwise will break :)
|
||||
)
|
||||
@@ -334,7 +334,7 @@ func dispatchFuncResult(ctx *context.Context, values []reflect.Value, handler Re
|
||||
// dispatchCommon is being used internally to send
|
||||
// commonly used data to the response writer with a smart way.
|
||||
func dispatchCommon(ctx *context.Context,
|
||||
statusCode int, contentType string, content []byte, v interface{}, handler ResultHandler, found bool) error {
|
||||
statusCode int, contentType string, content []byte, v any, handler ResultHandler, found bool) error {
|
||||
// if we have a false boolean as a return value
|
||||
// then skip everything and fire a not found,
|
||||
// we even don't care about the given status code or the object or the content.
|
||||
@@ -396,7 +396,7 @@ type Response struct {
|
||||
// previously set "ContentType". If "Lang" and "Text" are not empty
|
||||
// then this "Object" field becomes the template data that the
|
||||
// locale text should use to be rendered.
|
||||
Object interface{}
|
||||
Object any
|
||||
|
||||
// If Path is not empty then it will redirect
|
||||
// the client to this Path, if Code is >= 300 and < 400
|
||||
@@ -469,7 +469,7 @@ func (r Response) Dispatch(ctx *context.Context) {
|
||||
type View struct {
|
||||
Name string
|
||||
Layout string
|
||||
Data interface{} // map or a custom struct.
|
||||
Data any // map or a custom struct.
|
||||
Code int
|
||||
Err error
|
||||
}
|
||||
@@ -502,7 +502,7 @@ func (r View) Dispatch(ctx *context.Context) { // r as Response view.
|
||||
} else {
|
||||
// else check if r.Data is map or struct, if struct convert it to map,
|
||||
// do a range loop and modify the data one by one.
|
||||
// context.Map is actually a map[string]interface{} but we have to make that check:
|
||||
// context.Map is actually a map[string]any but we have to make that check:
|
||||
if m, ok := r.Data.(context.Map); ok {
|
||||
setViewData(ctx, m)
|
||||
} else if reflect.Indirect(reflect.ValueOf(r.Data)).Kind() == reflect.Struct {
|
||||
@@ -515,7 +515,7 @@ func (r View) Dispatch(ctx *context.Context) { // r as Response view.
|
||||
}
|
||||
}
|
||||
|
||||
func setViewData(ctx *context.Context, data map[string]interface{}) {
|
||||
func setViewData(ctx *context.Context, data map[string]any) {
|
||||
for k, v := range data {
|
||||
ctx.ViewData(k, v)
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ func GetCustomTypedPtrNilEmptyResponse() *iris.Map {
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetCustomMapNilEmptyResponse() map[string]interface{} {
|
||||
func GetCustomMapNilEmptyResponse() map[string]any {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ func TestFuncResult(t *testing.T) {
|
||||
ContentType("text/html", "utf-8").
|
||||
Body().IsEqual("<b>internal server error</b>")
|
||||
|
||||
expectedResultFromCustomStruct := map[string]interface{}{
|
||||
expectedResultFromCustomStruct := map[string]any{
|
||||
"name": "Iris",
|
||||
"age": 2,
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ func isIrisHandlerType(typ reflect.Type) bool {
|
||||
return typ == irisHandlerType || typ == irisHandlerFuncType
|
||||
}
|
||||
|
||||
func makeHandler(fn interface{}, c *Container, paramsCount int) context.Handler {
|
||||
func makeHandler(fn any, c *Container, paramsCount int) context.Handler {
|
||||
if fn == nil {
|
||||
panic("makeHandler: function is nil")
|
||||
}
|
||||
@@ -184,7 +184,7 @@ func makeHandler(fn interface{}, c *Container, paramsCount int) context.Handler
|
||||
}
|
||||
}
|
||||
|
||||
func isHandler(fn interface{}) (context.Handler, bool) {
|
||||
func isHandler(fn any) (context.Handler, bool) {
|
||||
if handler, ok := fn.(context.Handler); ok {
|
||||
return handler, ok
|
||||
}
|
||||
@@ -196,7 +196,7 @@ func isHandler(fn interface{}) (context.Handler, bool) {
|
||||
return nil, false
|
||||
}
|
||||
|
||||
func isHandlerWithError(fn interface{}) (func(*context.Context) error, bool) {
|
||||
func isHandlerWithError(fn any) (func(*context.Context) error, bool) {
|
||||
if handlerWithErr, ok := fn.(func(*context.Context) error); ok {
|
||||
return handlerWithErr, true
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"github.com/kataras/iris/v12/context"
|
||||
)
|
||||
|
||||
func valueOf(v interface{}) reflect.Value {
|
||||
func valueOf(v any) reflect.Value {
|
||||
if val, ok := v.(reflect.Value); ok {
|
||||
// check if it's already a reflect.Value.
|
||||
return val
|
||||
@@ -124,7 +124,7 @@ func equalTypes(binding reflect.Type, input reflect.Type) bool {
|
||||
return binding.AssignableTo(input)
|
||||
}
|
||||
|
||||
// dependency: func(...) interface{} { return "string" }
|
||||
// dependency: func(...) any { return "string" }
|
||||
// expected input: string.
|
||||
if binding.Kind() == reflect.Interface {
|
||||
return input.AssignableTo(binding)
|
||||
|
||||
@@ -55,7 +55,7 @@ func isMarkedAsSingleton(structPtr any) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func makeStruct(structPtr interface{}, c *Container, partyParamsCount int) *Struct {
|
||||
func makeStruct(structPtr any, c *Container, partyParamsCount int) *Struct {
|
||||
v := valueOf(structPtr)
|
||||
typ := v.Type()
|
||||
if typ.Kind() != reflect.Ptr || indirectType(typ).Kind() != reflect.Struct {
|
||||
|
||||
Reference in New Issue
Block a user