stringMapKey returns a reflect.Value holding the given string, reusing the same allocation every time. The result must be used (the map operation performed) before any recursive call, which may overwrite the buffer.
(s string)
| 364 | // same allocation every time. The result must be used (the map operation |
| 365 | // performed) before any recursive call, which may overwrite the buffer. |
| 366 | func (d *decoder) stringMapKey(s string) reflect.Value { |
| 367 | if !d.strKey.IsValid() { |
| 368 | d.strKey = reflect.New(stringType).Elem() |
| 369 | } |
| 370 | d.strKey.SetString(s) |
| 371 | return d.strKey |
| 372 | } |
| 373 | |
| 374 | // joinPath builds the NUL-joined representation of a key path in the |
| 375 | // decoder's scratch buffer. The result is only valid until the next call. |