FAQ

Search Discussions

  • Russ Cox at Dec 17, 2012 at 3:59 pm
    Sorry but it looks like someone else made some conflicting changes.
    Please hg sync, resolve the changes, and hg mail again.
  • Dave Cheney at Dec 21, 2012 at 5:12 am
    @ryanslade, something like this should work against +tip
    diff -r 7fe729534c6d src/pkg/encoding/json/decode.go
    --- a/src/pkg/encoding/json/decode.go Fri Dec 21 15:14:38 2012 +1100
    +++ b/src/pkg/encoding/json/decode.go Fri Dec 21 16:11:28 2012 +1100
    @@ -432,7 +432,7 @@
    case reflect.Map:
    // map must have string type
    t := v.Type()
    - if t.Key() != reflect.TypeOf("") {
    + if t.Key().Kind() != reflect.String {
    d.saveError(&UnmarshalTypeError{"object", v.Type()})
    break
    }
    @@ -539,7 +539,8 @@
    // Write value back to map;
    // if using struct, subv points into struct already.
    if v.Kind() == reflect.Map {
    - v.SetMapIndex(reflect.ValueOf(key), subv)
    + kv := reflect.ValueOf(key).Convert(v.Type().Key())
    + v.SetMapIndex(kv, subv)
    }

    On Tue, Dec 18, 2012 at 2:59 AM, Russ Cox wrote:
    Sorry but it looks like someone else made some conflicting changes.
    Please hg sync, resolve the changes, and hg mail again.
  • Ryanslade at Dec 24, 2012 at 6:08 pm
    Hello rsc@golang.org, dave@cheney.net (cc: golang-dev@googlegroups.com),

    Please take another look.


    https://codereview.appspot.com/6943047/
  • Dave at Dec 30, 2012 at 4:41 am
    *** Submitted as
    https://code.google.com/p/go/source/detail?r=7b6096868871 ***

    encoding/json: encode map key is of string kind, decode only of string
    type

    Allows encoding and decoding of maps with key of string kind, not just
    string type.
    Fixes issue 3519.

    R=rsc, dave
    CC=golang-dev
    https://codereview.appspot.com/6943047

    Committer: Dave Cheney <dave@cheney.net>


    https://codereview.appspot.com/6943047/

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedDec 17, '12 at 3:57p
activeDec 30, '12 at 4:41a
posts5
users3
websitegolang.org

3 users in discussion

Dave: 2 posts Russ Cox: 2 posts Ryanslade: 1 post

People

Translate

site design / logo © 2022 Grokbase