1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-09 15:12:26 +08:00

fix(orderedmap): fix set bug (#252)

set : when the key is present, the value of the data map should be set,
not the value of the list

Co-authored-by: congziqi <congziqi@lixiang.com>
This commit is contained in:
77
2024-10-12 14:05:13 +08:00
committed by GitHub
parent 213e2b4ead
commit cb08613ac3
2 changed files with 5 additions and 1 deletions

View File

@@ -35,7 +35,7 @@ func (om *OrderedMap[K, V]) Set(key K, value V) {
defer om.mu.Unlock()
if elem, ok := om.index[key]; ok {
elem.Value = value
om.data[key] = value
om.order.MoveToBack(elem)
return