[go-nuts] Get a copy of reflect.Value's underlying value

2017-07-31 Thread eZio Pan
Hello, I want to build a "universal slice reverser" with reflect.MakeFunc. But I don't know how to get a copy of reflect.Value's underlying value, which make result not correct. Here is the code: package main import ( "fmt" "reflect" ) func reverse(in []reflect.Value) (out []reflect.Value) {

[go-nuts] Re: Why a []interface{} containing 2 different interface should use function like this?

2017-05-05 Thread eZio Pan
o specify the > variables types if you initialize them like you did). > > https://play.golang.org/p/pJHU0Dq8t6 > > Le vendredi 5 mai 2017 13:35:42 UTC+2, eZio Pan a écrit : >> >> Hi, I'm a newbie in Golang. I get stuck in a problem that I can't >> understand why

[go-nuts] Why a []interface{} containing 2 different interface should use function like this?

2017-05-05 Thread eZio Pan
Hi, I'm a newbie in Golang. I get stuck in a problem that I can't understand why. I wish someone could help me out. Thanks! There are 2 struct type *S1* and *S2*. Both of them implement interface type *StringI*. I write a function called *run* which use *StringI* interface as input, and run