From e22b61eb727a83128c5f22cc3e9492ee63cc321e Mon Sep 17 00:00:00 2001 From: Skyxim Date: Sun, 15 Dec 2024 10:36:26 +0800 Subject: [PATCH] Revert "fix: handle invalid values in Decoder's decode method" This reverts commit 3b918fb0409cd46e43824b73f33de659862b291f. --- common/structure/structure.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/common/structure/structure.go b/common/structure/structure.go index 9c8034cb4f..99c980bc4c 100644 --- a/common/structure/structure.go +++ b/common/structure/structure.go @@ -87,11 +87,6 @@ func (d *Decoder) Decode(src map[string]any, dst any) error { } func (d *Decoder) decode(name string, data any, val reflect.Value) error { - if !val.IsValid() { - // TODO: Why is an invalid value generated? - // If an invalid value is passed to `decodeString`, it will panic due to the call to `Type()`. - return fmt.Errorf("'%s' is not valid", name) - } for { kind := val.Kind() if kind == reflect.Pointer && val.IsNil() {