mailru / easyjson

Fast JSON serializer for golang.
MIT License
4.48k stars 421 forks source link

Give an explicit error message for nested maps with unsupported key type #50

Closed hectorj closed 7 years ago

hectorj commented 8 years ago

When trying to apply easyjson to nested maps like map[string]map[uint32]string, it produces invalid code:

        for v2_name, v2_value := range in.Field {
            if !v2_first {
                out.RawByte(',')
            }
            v2_first = false
            out.String(string(v2_name))
            out.RawByte(':')
        }

which gives this error:

v2_value declared and not used

It would be nice to have an explicit error message, like we get with non-nested maps:

map type uint32 not supported: only string keys are allowed

cespare commented 7 years ago

Related: #127

rvasily commented 7 years ago

PR #144 merged. Check it please