mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-01-11 01:47:53 +08:00
17 lines
281 B
Go
17 lines
281 B
Go
|
package models
|
||
|
|
||
|
import (
|
||
|
"bytes"
|
||
|
"encoding/gob"
|
||
|
)
|
||
|
|
||
|
func copyObj(input interface{}, output interface{}) error {
|
||
|
buf := &bytes.Buffer{}
|
||
|
enc := gob.NewEncoder(buf)
|
||
|
dec := gob.NewDecoder(buf)
|
||
|
if err := enc.Encode(input); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
return dec.Decode(output)
|
||
|
}
|