You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: normalise Keys/Values nil-vs-empty slice with Map #54
Keys() and Values() return nil for an empty map (because append onto a nil slice stays nil). Map() returns an empty non-nil map. That asymmetry is observable (keys == nil is true for Keys but the same check on Map's return is false) and not documented.
Scope
Either:
A. Make Keys/Values return non-nil empty slices (make([]K, 0)) — consistent with Map's non-nil contract. Probably the right call since #TBD also pre-allocates.
B. Keep current behaviour but document explicitly.
Acceptance criteria
TestKeys_Empty and TestValues_Empty assert non-nil slice (or explicitly nil — whichever is chosen).
Godoc on all three methods consistent about nil-vs-empty return.
Activity