Commit 7d9d91d5 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 91c8c66b
This diff is collapsed.
......@@ -261,7 +261,14 @@ func (d *decoder) emitobjtype(assignto string, obj types.Object, typ types.Type)
break
}
d.emit("%s = %s", assignto, d.decodedBasic(obj, u))
decoded := d.decodedBasic(obj, u)
if typ != u {
// typ is a named type over some basic, like
// type ClusterState int32
// -> need to cast
decoded = fmt.Sprintf("%v(%v)", typ, decoded)
}
d.emit("%s = %s", assignto, decoded)
case *types.Array:
// TODO optimize for [...]byte
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment