github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/common/utils/structsUtils.go (about)

     1  package utils
     2  
     3  import (
     4  	"bytes"
     5  	"encoding/gob"
     6  )
     7  
     8  /**
     9  deep-copies src to desc
    10  using go.gob
    11  **/
    12  func CopyProperties(src interface{}, desc interface{}) {
    13  	var buff bytes.Buffer
    14  	enc := gob.NewEncoder(&buff)
    15  	dec := gob.NewDecoder(&buff)
    16  	enc.Encode(src)
    17  	dec.Decode(desc)
    18  }