Skip to content

Commit

Permalink
up: replace inteface{} to any keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Feb 21, 2023
1 parent e9c75b8 commit 1be8dd7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion options.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type Options struct {
// MapStructConfig for binding data to struct.
MapStructConfig mapstructure.DecoderConfig
// BeforeCollect value handle func, you can return a new value.
BeforeCollect func(name string, val any) interface{}
BeforeCollect func(name string, val any) any
}

func (opts *Options) makeDecoderConfig() *mapstructure.DecoderConfig {
Expand Down
2 changes: 1 addition & 1 deletion options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ expire = 3s

// tests Unmarshal, BeforeCollect
p := properties.NewParser(properties.ParseTime, func(opts *properties.Options) {
opts.BeforeCollect = func(name string, val any) interface{} {
opts.BeforeCollect = func(name string, val any) any {
if name == "name" {
return strutil.Upper(val.(string))
}
Expand Down
2 changes: 1 addition & 1 deletion util.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

// ValDecodeHookFunc returns a mapstructure.DecodeHookFunc that parse time string
func ValDecodeHookFunc() mapstructure.DecodeHookFunc {
return func(f reflect.Type, t reflect.Type, data any) (interface{}, error) {
return func(f reflect.Type, t reflect.Type, data any) (any, error) {
if f.Kind() != reflect.String {
return data, nil
}
Expand Down

0 comments on commit 1be8dd7

Please sign in to comment.