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 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 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 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 the fields, the same way like the Girl
> > struct have them exported, ie. by making the first character of the
> > names upper case.
> > 
> > hth
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "golang-nuts" group.
> > To unsubscribe from this group and stop receiving emails from it, send 
> > an email to golang-nuts...@googlegroups.com 
> > <mailto:golang-nuts...@googlegroups.com>.
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/golang-nuts/ae320735-c158-4911-ad26-12e485ab9e99n%40googlegroups.com
>  
> <
> https://groups.google.com/d/msgid/golang-nuts/ae320735-c158-4911-ad26-12e485ab9e99n%40googlegroups.com?utm_medium=email&utm_source=footer
> >.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/898a8c2c-7474-4ffe-a6cf-f642fbef493dn%40googlegroups.com.

Reply via email to