On 22 November 2017 at 18:57, 'simon place' via golang-nuts
wrote:
> thanks,
>
> this cloning is an optimisation, slowing it down a lot makes it pointless to
> begin with, but luckily really, the program produced has a built-in list of
> selectable, std.lib., hash routines to select from.
>
> i wi
thanks,
this cloning is an optimisation, slowing it down a lot makes it pointless
to begin with, but luckily really, the program produced has a built-in list
of selectable, std.lib., hash routines to select from.
i will add a warning for someone forking it about this.
BTW your improved clon
On 21 November 2017 at 21:56, 'simon place' via golang-nuts
wrote:
> i found this code, and use it on hash.Hash
>
> // copy an interface value using reflect (here for pointers to interfaces)
> func clone(i interface{}) interface{} {
> indirect := reflect.Indirect(reflect.ValueOf(i))
> newI
i found this code, and use it on hash.Hash
// copy an interface value using reflect (here for pointers to interfaces)
func clone(i interface{}) interface{} {
indirect := reflect.Indirect(reflect.ValueOf(i))
newIndirect := reflect.New(indirect.Type())
newIndirect.Elem().Set(reflect.Valu