I'm working with two libraries, and one defines a type:
type Attrs map[string]string
while the other defines:
type StringMap map[string]string
A function from the first library returns an []Attrs
, and struct required by the other has a field as []StringMap
which needs to be set. Attempting to either use a simple assignment, or a cast in the form of ([]StringMap)(attrs)
, just results in an error:
./wscmd.go:8:22: cannot convert attrs (type []mpd.Attrs) to type []StringMap
So, how can those be bridged?
Edit: Ok, apparently this is a language limitation (booo-hooo). Can it be stepped aside with unsafe pointers?