Tags: go-zoox/kv
Tags
fix(memory): panic on plain values with reflect.Elem() reflect.Value.Elem() panics when called on non-pointer types (string, int, bool, etc.). When a plain value is stored via Set() and retrieved via Get(), the old code unconditionally called v.Elem() which crashes with 'reflect: call of reflect.Value.Elem on string Value'. Fix: check stored value kind before calling Elem(). Only dereference if it's a pointer; set plain values directly. Tests: added 12 memory-specific tests covering plain string/int/bool/ slice Get/Set, TTL expiry, Size/Keys/Clear/Overwrite. Added shared RunPlainValuesTestCase to test suite covering 7 value types.
PreviousNext