Comments (7)
@qzyse2017 Can't agree, it's just a temporary solution. What if we have 300 nested field? It should be handled inside the library, if the nested field is nil, then reflect.New with the type of the field.
from copier.
Possible it's trying to call the reflectValue.Elem()
on a nil reflect.Value
, so it won't have an exact Elem()
. But correct me if I'm not right.
from copier.
@sudo-suhas have you found any fix for this?
from copier.
No.
from copier.
b.nested = &nested{}
initialize the pointer can avoid panic.
https://play.golang.org/p/o4m2S_pqJPH
from copier.
Hey. Any update on this? Is fix coming to the library?
from copier.
This example uses unexported anonymous fields. Unexported fields cannot be copied to.
PR #72 adds support for exported anonymous fields and avoid panic in case of anonymous fields.
from copier.
Related Issues (20)
- copy of slice doesn't replace the whole slice HOT 3
- It does not working correctly HOT 1
- Deepcopy on interface pointers not working properly
- I want to merge the data of two structures HOT 1
- Use copier without reflection
- Copy unexpected behavior when two fields have same lower case name HOT 1
- Deep Copy is not working after upgrading to 0.4.0
- Custom function for merging fields
- In some cases, copying all variables failed when using tags to copy HOT 3
- Why did the Struct replication implementation change from v0.3.5 to v0.4.0?
- UnicodeDecodeError: 'gbk' codec can't decode byte 0x99 in position 763: illegal multibyte sequence HOT 1
- [bug report] The private field is hindering the copier from functioning properly. HOT 1
- Unexported copy of struct is failing
- Non existent fields on source struct is still over ridden in destination struct HOT 1
- specify multiple field name
- Inconsistent Field Copying Behavior with Different Field Types
- 如何Copy非匿名嵌套结构体 HOT 2
- Unexported struct fields which are pointers are not deep copied
- 可以排除某些字段不复制吗?
- Nil Slice Becomes Empty Slice After Copying
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from copier.