mohae / deepcopy

Deep copy things
MIT License
569 stars 122 forks source link

Make public copyRecursive(original, cpy reflect.Value) #6

Closed trakhimenok closed 7 years ago

trakhimenok commented 7 years ago

For unit testing/mock purpose I need to copy struct to an existing pointer instance.

For example I have:

func Get(key int, val interace{}) error {
  //...
  return nil
}

In the mock I would like to do:

func Get(key int, val interace{}) error {
  deepcopy.CopyRecursive(someVal, val)
  return nil
}

Any reasons to exclude copyRecursive() from exporting?

mohae commented 7 years ago

Sorry for the delayed response.

I hadn't really thought about making it exported.

If you wish to make a pull request exporting it, I'll be happy to accept it.

trakhimenok commented 7 years ago

@mohae, thanks!