01 Jan 2016
Make a slice from a type
Do you know how to make a slice from a type of value. We will do it with
reflect.MakeSlice of reflect package but it’s a little complex to fulfill.
Actually, it’s easy if you know how to implement.
At first, make
reflect.Type from a value which is what you want slice. Then, use
reflect.MakeSlice to obtain your slice.
Code, All of your need
I wrote an example of
MakeSlice for you all!
So see and touch the following code. :)
Simply Run the code below.
Til next time,
kaneshin at 00:30