I would like to cast empty interface to map. Why is this not ok?
// q tarantool.Queue (https://github.com/tarantool/go-tarantool)
statRaw, _ := q.Statistic() // interface{}; map[tasks:map[taken:0 buried:0 ...] calls:map[put:1 delay:0 ...]]
type stat map[string]map[string]uint
_, ok := statRaw.(stat)
Your function returns a
map[string]map[string]uint
, not astat
. They are distinct types in go's type-system. Either type-assert tomap[string]map[string]uint
or, in Go 1.9, you can create an alias instead:See https://play.golang.org/p/Xf1TPjSI3_