Skip to content

Commit 5c92f3a

Browse files
committed
chore: err113 linter rule...
1 parent 1837a5d commit 5c92f3a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

config/options.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ func (ll *LogLevel) Level() log.Level {
4343
return (log.Level)(*ll)
4444
}
4545

46+
var (
47+
// Define a static error
48+
ErrInvalidDataType = errors.New("invalid data type, expected string")
49+
)
4650
func LogLevelDecodeHookFunc() mapstructure.DecodeHookFunc {
4751
return func(
4852
f reflect.Type,
@@ -59,7 +63,7 @@ func LogLevelDecodeHookFunc() mapstructure.DecodeHookFunc {
5963

6064
str, ok := data.(string)
6165
if !ok {
62-
return InfoLevel, fmt.Errorf("expected string but got %T", data)
66+
return InfoLevel, fmt.Errorf("%w: got %T", ErrInvalidDataType, data)
6367
}
6468

6569
level, err := log.ParseLevel(str)

0 commit comments

Comments
 (0)