I have a struct
type mapKey string
var key1 mapKey = "someKey"
var key2 mapKey = "anotherKey"
type SampleMap map[mapKey]string
Incoming http call has to be map[string]string
which I need to typecast to SampleMap in the business logic
The normal casting : Sample(request) gives an error, cannot convert type map[string]string to SampleMap. Since these both have the same internal type, why is this error occuring and what is the work around?
I really don't want to write a function to map each string to mapKey and then construct SampleMap.