You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
258 B
15 lines
258 B
|
1 year ago
|
package util
|
||
|
|
|
||
|
|
import (
|
||
|
|
"bytes"
|
||
|
|
"encoding/gob"
|
||
|
|
)
|
||
|
|
|
||
|
|
func DeepCopy(dst, src interface{}) error {
|
||
|
|
var buf bytes.Buffer
|
||
|
|
if err := gob.NewEncoder(&buf).Encode(src); err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
return gob.NewDecoder(bytes.NewBuffer(buf.Bytes())).Decode(dst)
|
||
|
|
}
|