Skip to content

Commit

Permalink
codec: set containerState to containerMapKey when encoding interface{…
Browse files Browse the repository at this point in the history
…} keys of a map in canonical mode

Without this, MapKeyAsString option is not supported correctly.

Fixes #390
  • Loading branch information
ugorji committed Feb 19, 2023
1 parent 8c5d7aa commit b7b66ee
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions codec/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,7 @@ func (e *Encoder) kMapCanonical(ti *typeInfo, rv, rvv reflect.Value, keyFn, valF
v := &mksbv[i]
l := len(mksv)

e.c = containerMapKey
e.encodeValue(k, nil)
e.atEndOfEncode()
e.w().end()
Expand Down

0 comments on commit b7b66ee

Please sign in to comment.