mohae / deepcopy

Deep copy things
MIT License
569 stars 122 forks source link

facing issue while call deepcopy #27

Open ghost opened 3 years ago

ghost commented 3 years ago

When I call deepcopy method, i am facing issue. ===================METHOD================== response.BdtReqData = deepcopy.Copy(&request).(*models.BdtReqData)

=====================BdtReqData======================== package models

type BdtReqData struct { AspId string json:"aspId" yaml:"aspId" bson:"aspId" mapstructure:"AspId" DesTimeInt TimeWindow json:"desTimeInt" yaml:"desTimeInt" bson:"desTimeInt" mapstructure:"DesTimeInt" NwAreaInfo NetworkAreaInfo json:"nwAreaInfo,omitempty" yaml:"nwAreaInfo" bson:"nwAreaInfo" mapstructure:"NwAreaInfo" NumOfUes int32 json:"numOfUes" yaml:"numOfUes" bson:"numOfUes" mapstructure:"NumOfUes" VolPerUe *UsageThreshold json:"volPerUe" yaml:"volPerUe" bson:"volPerUe" mapstructure:"VolPerUe" SuppFeat string json:"suppFeat,omitempty" yaml:"suppFeat" bson:"suppFeat" mapstructure:"SuppFeat" }

==================Request Restful API Call=========================== curl -X 'POST' \ 'http://127.0.0.7:8000/npcf-bdtpolicycontrol/v1/bdtpolicies' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "aspId": "ASP001", "desTimeInt": { "startTime": "2021-09-25T18:07:00.083Z", "stopTime": "2021-09-26T21:09:45.083Z" }, "numOfUes": 3, "volPerUe": { "duration": 360, "totalVolume": 1024, "downlinkVolume": 512, "uplinkVolume": 512 } }' ================Error============================= 2021/09/29 10:10:34 [Recovery] 2021/09/29 - 10:10:34 panic recovered: interface conversion: interface {} is *models.BdtReqData, not models.BdtReqData /usr/local/go/src/runtime/iface.go:260 (0x409b71) panicdottypeE: panic(&TypeAssertionError{iface, have, want, ""})

dolmen commented 2 years ago

Please submit a reduced test case.

huangguiqiu commented 1 year ago

maybe your request already is pointer