yes I can do this in a for loop. but that is not I want.

what I really want to do is "create a function that returns sorted []string 
keys from any map[string]... in type safe way".

when I said 'there is no easy way...' , I mean I cannot create that 
function easily.

I did not very clarify. sorry for the confusion. 

2019년 3월 2일 토요일 오후 8시 46분 50초 UTC+9, Louki Sumirniy 님의 말:
>
> Only an assigment to a pre-declared map[string]interface{} in a loop 
> walking the first layer of that complex map type is required to put the 
> values into that type, it's not complicated and doesn't have to touch the 
> template. Something like this:
>
> var MapStringInterface map[string]interface{}
> for i,x := range MapStringMapStringThing {
>     MapStringInterface[i]=x
> }
>
> On Saturday, 2 March 2019 11:01:10 UTC+1, 김용빈 wrote:
>>
>> Thank you, Mercl.
>>
>> So there isn't an easy way, you mean, right?
>>
>> 2019년 3월 2일 토요일 오후 6시 45분 8초 UTC+9, Jan Mercl 님의 말:
>>>
>>> On Sat, Mar 2, 2019 at 10:32 AM 김용빈 <kyb...@gmail.com> wrote:
>>>
>>> > but it seems the argument is not automatically converted.
>>>
>>> Things are automatically converted to a different type in Go only when 
>>> they are assigned to, or passed as arguments of, interface types.
>>>
>>> > manual type cast `map[string]interface{}(myMap)` also not working.
>>> > is there a way of doing this? 
>>>
>>> Go does not have casts. Conversion rules[0] do not allow a conversion of 
>>> different map types because the memory layouts are not compatible.
>>>
>>>   [0]: https://golang.org/ref/spec#Conversions
>>>
>>> -- 
>>>
>>> -j
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to