Skip to content

Commit 92164ce

Browse files
committed
CI: minor: use the new exclude-paths (dependabot PR approved some days ago)
1 parent a8a3afe commit 92164ce

37 files changed

+268
-266
lines changed

.github/dependabot.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ version: 2
22
updates:
33
- package-ecosystem: "gomod"
44
directory: "/"
5+
exclude-paths:
6+
- "_examples/"
57
schedule:
6-
interval: "weekly"
8+
interval: "monthly"
79
- package-ecosystem: "github-actions"
810
directory: "/"
911
schedule:
10-
interval: "weekly"
12+
interval: "monthly"

apps/switch_hosts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type (
1919
Pattern string
2020
// Target is the target Host that incoming requests will be redirected on pattern match
2121
// or an Application's Name that will handle the incoming request matched the Pattern.
22-
Target interface{} // It was a string in my initial design but let's do that interface{}, we may support more types here in the future, until generics are in, keep it interface{}.
22+
Target any // It was a string in my initial design but let's do that any, we may support more types here in the future, until generics are in, keep it any.
2323
}
2424
// Hosts is a switch provider.
2525
// It can be used as input argument to the `Switch` function

context/application.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ type Application interface {
3030

3131
// Validate validates a value and returns nil if passed or
3232
// the failure reason if not.
33-
Validate(interface{}) error
33+
Validate(any) error
3434

3535
// Minifier returns the minifier instance.
3636
// By default it can minifies:
@@ -44,7 +44,7 @@ type Application interface {
4444
//
4545
// Use context.View to render templates to the client instead.
4646
// Returns an error on failure, otherwise nil.
47-
View(writer io.Writer, filename string, layout string, bindingData interface{}) error
47+
View(writer io.Writer, filename string, layout string, bindingData any) error
4848

4949
// GetContextPool returns the Iris sync.Pool which holds the contexts values.
5050
// Iris automatically releases the request context, so you don't have to use it.

context/compress.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func NewCompressReader(src io.Reader, encoding string) (*CompressReader, error)
170170
}, nil
171171
}
172172

173-
var compressWritersPool = sync.Pool{New: func() interface{} { return &CompressResponseWriter{} }}
173+
var compressWritersPool = sync.Pool{New: func() any { return &CompressResponseWriter{} }}
174174

175175
// AddCompressHeaders just adds the headers "Vary" to "Accept-Encoding"
176176
// and "Content-Encoding" to the given encoding.

context/configuration.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,5 @@ type ConfigurationReadOnly interface {
9696
// GetHostProxyHeaders returns the HostProxyHeaders field.
9797
GetHostProxyHeaders() map[string]bool
9898
// GetOther returns the Other field.
99-
GetOther() map[string]interface{}
99+
GetOther() map[string]any
100100
}

context/context.go

Lines changed: 98 additions & 98 deletions
Large diffs are not rendered by default.

context/context_func.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ var ErrInvalidArgs = errors.New("invalid arguments")
1313
// Func represents a function registered by the Context.
1414
// See its `buildMeta` and `call` internal methods.
1515
type Func struct {
16-
RegisterName string // the name of which this function is registered, for information only.
17-
Raw interface{} // the Raw function, can be used for custom casting.
18-
PersistenceArgs []interface{} // the persistence input arguments given on registration.
16+
RegisterName string // the name of which this function is registered, for information only.
17+
Raw any // the Raw function, can be used for custom casting.
18+
PersistenceArgs []any // the persistence input arguments given on registration.
1919

2020
once sync.Once // guards build once, on first call.
2121
// Available after the first call.
2222
Meta *FuncMeta
2323
}
2424

25-
func newFunc(name string, fn interface{}, persistenceArgs ...interface{}) *Func {
25+
func newFunc(name string, fn any, persistenceArgs ...any) *Func {
2626
return &Func{
2727
RegisterName: name,
2828
Raw: fn,
@@ -37,8 +37,8 @@ type FuncMeta struct {
3737
HandlerWithErr func(*Context) error // when it's just a handler which returns an error.
3838
RawFunc func() // when it's just a func.
3939
RawFuncWithErr func() error // when it's just a func which returns an error.
40-
RawFuncArgs func(...interface{})
41-
RawFuncArgsWithErr func(...interface{}) error
40+
RawFuncArgs func(...any)
41+
RawFuncArgsWithErr func(...any) error
4242

4343
Value reflect.Value
4444
Type reflect.Type
@@ -65,10 +65,10 @@ func (f *Func) buildMeta() {
6565
case func() error:
6666
f.Meta = &FuncMeta{RawFuncWithErr: fn}
6767
return
68-
case func(...interface{}):
68+
case func(...any):
6969
f.Meta = &FuncMeta{RawFuncArgs: fn}
7070
return
71-
case func(...interface{}) error:
71+
case func(...any) error:
7272
f.Meta = &FuncMeta{RawFuncArgsWithErr: fn}
7373
return
7474
}
@@ -119,7 +119,7 @@ func (f *Func) buildMeta() {
119119
f.Meta = &meta
120120
}
121121

122-
func (f *Func) call(ctx *Context, args ...interface{}) ([]reflect.Value, error) {
122+
func (f *Func) call(ctx *Context, args ...any) ([]reflect.Value, error) {
123123
f.once.Do(f.buildMeta)
124124
meta := f.Meta
125125

context/context_user.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ var ErrNotSupported = errors.New("not supported")
3434
// - UserPartial (a wrapper by SetUser)
3535
type User interface {
3636
// GetRaw should return the raw instance of the user, if supported.
37-
GetRaw() (interface{}, error)
37+
GetRaw() (any, error)
3838
// GetAuthorization should return the authorization method,
3939
// e.g. Basic Authentication.
4040
GetAuthorization() (string, error)
@@ -60,12 +60,12 @@ type User interface {
6060
// GetField should optionally return a dynamic field
6161
// based on its key. Useful for custom user fields.
6262
// Keep in mind that these fields are encoded as a separate JSON key.
63-
GetField(key string) (interface{}, error)
63+
GetField(key string) (any, error)
6464
} /* Notes:
6565
We could use a structure of User wrapper and separate interfaces for each of the methods
6666
so they return ErrNotSupported if the implementation is missing it, so the `Features`
6767
field and HasUserFeature can be omitted and
68-
add a Raw() interface{} to return the underline User implementation too.
68+
add a Raw() any to return the underline User implementation too.
6969
The advandages of the above idea is that we don't have to add new methods
7070
for each of the builtin features and we can keep the (assumed) struct small.
7171
But we dont as it has many disadvantages, unless is requested.
@@ -95,7 +95,7 @@ type SimpleUser struct {
9595
var _ User = (*SimpleUser)(nil)
9696

9797
// GetRaw returns itself.
98-
func (u *SimpleUser) GetRaw() (interface{}, error) {
98+
func (u *SimpleUser) GetRaw() (any, error) {
9999
return u, nil
100100
}
101101

@@ -156,18 +156,18 @@ func (u *SimpleUser) GetToken() ([]byte, error) {
156156

157157
// GetField optionally returns a dynamic field from the `Fields` field
158158
// based on its key.
159-
func (u *SimpleUser) GetField(key string) (interface{}, error) {
159+
func (u *SimpleUser) GetField(key string) (any, error) {
160160
if u.Fields == nil {
161161
return nil, ErrNotSupported
162162
}
163163

164164
return u.Fields[key], nil
165165
}
166166

167-
// UserMap can be used to convert a common map[string]interface{} to a User.
167+
// UserMap can be used to convert a common map[string]any to a User.
168168
// Usage:
169169
//
170-
// user := map[string]interface{}{
170+
// user := map[string]any{
171171
// "username": "kataras",
172172
// "age" : 27,
173173
// }
@@ -189,7 +189,7 @@ type UserMap Map
189189
var _ User = UserMap{}
190190

191191
// GetRaw returns the underline map.
192-
func (u UserMap) GetRaw() (interface{}, error) {
192+
func (u UserMap) GetRaw() (any, error) {
193193
return Map(u), nil
194194
}
195195

@@ -235,11 +235,11 @@ func (u UserMap) GetToken() ([]byte, error) {
235235

236236
// GetField returns the raw map's value based on its "key".
237237
// It's not kind of useful here as you can just use the map.
238-
func (u UserMap) GetField(key string) (interface{}, error) {
238+
func (u UserMap) GetField(key string) (any, error) {
239239
return u[key], nil
240240
}
241241

242-
func (u UserMap) val(key string) interface{} {
242+
func (u UserMap) val(key string) any {
243243
isTitle := unicode.IsTitle(rune(key[0])) // if starts with uppercase.
244244
if isTitle {
245245
key = strings.ToLower(key)
@@ -333,15 +333,15 @@ type (
333333
}
334334

335335
userGetField interface {
336-
GetField(string) interface{}
336+
GetField(string) any
337337
}
338338

339339
// UserPartial is a User.
340340
// It's a helper which wraps a struct value that
341341
// may or may not complete the whole User interface.
342342
// See Context.SetUser.
343343
UserPartial struct {
344-
Raw interface{} `json:"raw"`
344+
Raw any `json:"raw"`
345345
userGetAuthorization `json:",omitempty"`
346346
userGetAuthorizedAt `json:",omitempty"`
347347
userGetID `json:",omitempty"`
@@ -356,7 +356,7 @@ type (
356356

357357
var _ User = (*UserPartial)(nil)
358358

359-
func newUserPartial(i interface{}) *UserPartial {
359+
func newUserPartial(i any) *UserPartial {
360360
if i == nil {
361361
return nil
362362
}
@@ -407,7 +407,7 @@ func newUserPartial(i interface{}) *UserPartial {
407407
}
408408

409409
// GetRaw returns the original raw instance of the user.
410-
func (u *UserPartial) GetRaw() (interface{}, error) {
410+
func (u *UserPartial) GetRaw() (any, error) {
411411
if u == nil {
412412
return nil, ErrNotSupported
413413
}
@@ -496,7 +496,7 @@ func (u *UserPartial) GetToken() ([]byte, error) {
496496
// GetField should optionally return a dynamic field
497497
// based on its key. Useful for custom user fields.
498498
// Keep in mind that these fields are encoded as a separate JSON key.
499-
func (u *UserPartial) GetField(key string) (interface{}, error) {
499+
func (u *UserPartial) GetField(key string) (any, error) {
500500
if v := u.userGetField; v != nil {
501501
return v.GetField(key), nil
502502
}

context/fs.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
// It affects the view engine's filesystem resolver.
1818
//
1919
// This package-level variable can be modified on initialization.
20-
var ResolveFS = func(fsOrDir interface{}) fs.FS {
20+
var ResolveFS = func(fsOrDir any) fs.FS {
2121
if fsOrDir == nil {
2222
return noOpFS{}
2323
}
@@ -101,7 +101,7 @@ func (f *httpFS) ReadDir(name string) ([]fs.DirEntry, error) {
101101
// It affects the Application's API Builder's `HandleDir` method.
102102
//
103103
// This package-level variable can be modified on initialization.
104-
var ResolveHTTPFS = func(fsOrDir interface{}) http.FileSystem {
104+
var ResolveHTTPFS = func(fsOrDir any) http.FileSystem {
105105
var fileSystem http.FileSystem
106106
switch v := fsOrDir.(type) {
107107
case string:

context/handler.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ type Handler = func(*Context)
131131
// See `Handler` for more.
132132
type Handlers = []Handler
133133

134-
func valueOf(v interface{}) reflect.Value {
134+
func valueOf(v any) reflect.Value {
135135
if val, ok := v.(reflect.Value); ok {
136136
return val
137137
}
@@ -142,7 +142,7 @@ func valueOf(v interface{}) reflect.Value {
142142
// HandlerName returns the handler's function name.
143143
// See `Context.HandlerName` method to get function name of the current running handler in the chain.
144144
// See `SetHandlerName` too.
145-
func HandlerName(h interface{}) string {
145+
func HandlerName(h any) string {
146146
pc := valueOf(h).Pointer()
147147
fn := runtime.FuncForPC(pc)
148148
name := fn.Name()
@@ -166,10 +166,10 @@ func HandlerName(h interface{}) string {
166166
// or to determinate if end-developer
167167
// called the same exactly Use/UseRouter/Done... API methods
168168
// so framework can give a warning.
169-
func HandlersNames(handlers ...interface{}) string {
169+
func HandlersNames(handlers ...any) string {
170170
if len(handlers) == 1 {
171171
if hs, ok := handlers[0].(Handlers); ok {
172-
asInterfaces := make([]interface{}, 0, len(hs))
172+
asInterfaces := make([]any, 0, len(hs))
173173
for _, h := range hs {
174174
asInterfaces = append(asInterfaces, h)
175175
}
@@ -188,14 +188,14 @@ func HandlersNames(handlers ...interface{}) string {
188188

189189
// HandlerFileLine returns the handler's file and line information.
190190
// See `context.HandlerFileLine` to get the file, line of the current running handler in the chain.
191-
func HandlerFileLine(h interface{}) (file string, line int) {
191+
func HandlerFileLine(h any) (file string, line int) {
192192
pc := valueOf(h).Pointer()
193193
return runtime.FuncForPC(pc).FileLine(pc)
194194
}
195195

196196
// HandlerFileLineRel same as `HandlerFileLine` but it returns the path
197197
// corresponding to its relative based on the package-level "WorkingDir" variable.
198-
func HandlerFileLineRel(h interface{}) (file string, line int) {
198+
func HandlerFileLineRel(h any) (file string, line int) {
199199
file, line = HandlerFileLine(h)
200200
if relFile, err := filepath.Rel(WorkingDir, file); err == nil {
201201
if !strings.HasPrefix(relFile, "..") {
@@ -209,13 +209,13 @@ func HandlerFileLineRel(h interface{}) (file string, line int) {
209209

210210
// MainHandlerName tries to find the main handler that end-developer
211211
// registered on the provided chain of handlers and returns its function name.
212-
func MainHandlerName(handlers ...interface{}) (name string, index int) {
212+
func MainHandlerName(handlers ...any) (name string, index int) {
213213
if len(handlers) == 0 {
214214
return
215215
}
216216

217217
if hs, ok := handlers[0].(Handlers); ok {
218-
tmp := make([]interface{}, 0, len(hs))
218+
tmp := make([]any, 0, len(hs))
219219
for _, h := range hs {
220220
tmp = append(tmp, h)
221221
}

0 commit comments

Comments
 (0)