Re: [go-nuts] encoding/asn1 I can't Marshal a struct with pointer members

2024-04-29 Thread Jason Phillips
Then that type probably won't work with encoding/asn1. If you have control over the call to asn1.Marshal, you could always create a "data transfer object " to translate between this third-party type and a type that you control that has a struc

Re: [go-nuts] encoding/asn1 I can't Marshal a struct with pointer members

2024-04-29 Thread J Liu
Thank you very much for your answer, but I cannot modify the definition of the field because this is the structure of the third-party library. On Monday, April 29, 2024 at 1:01:18 AM UTC+8 Def Ceb wrote: > Most marshal/unmarshal functions are unwilling to marshal/unmarshal > structs with pointer

Re: [go-nuts] encoding/asn1 I can't Marshal a struct with pointer members

2024-04-28 Thread Def Ceb
Most marshal/unmarshal functions are unwilling to marshal/unmarshal structs with pointer fields. Changing them to direct values fixes this. Example: https://go.dev/play/p/ykmpBm0bXqn I do not think there is any other simple alternative. J Liu: I understand this problem. My real program uses expo

Re: [go-nuts] encoding/asn1 I can't Marshal a struct with pointer members

2024-04-28 Thread J Liu
I understand this problem. My real program uses export correctly, but the problem I have is not export, asn1: structure error: unknown Go type: *pkg.Girl On Sunday, April 28, 2024 at 9:27:42 AM UTC+8 Jan Mercl wrote: > > > On Sun, Apr 28, 2024, 03:03 J Liu <88592...@gmail.com> wrote: > >> My pr

Re: [go-nuts] encoding/asn1 I can't Marshal a struct with pointer members

2024-04-27 Thread Jan Mercl
On Sun, Apr 28, 2024, 03:03 J Liu <8859210...@gmail.com> wrote: > My program is like this: > > type Girl struct { > Name string > Age int > } > > type Person struct { > girl *Girl > job string > } > > > What should I do to Marshal 'Person'? > I think you need to export th

[go-nuts] encoding/asn1 I can't Marshal a struct with pointer members

2024-04-27 Thread J Liu
My program is like this: type Girl struct { Name string Age int } type Person struct { girl *Girl job string } What should I do to Marshal 'Person'? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from t