FAQ
This seems to be a bug (or two) with the gob package.

    1. It seems that gob does encode and decode the anonymous
    field: https://play.golang.org/p/SxXP2b-EQC, but it drops the contents of
    Name while encoding.
    2. Even if anonymous fields were not to be supported, I don't think the
    library should panic like that.

Would be a good idea to file an issue.
On Tuesday, January 5, 2016 at 9:29:49 PM UTC-8, Larry Clapp wrote:

This works: http://play.golang.org/p/nUENUMDM7x

time.Time field is called T

output is
"Pythagoras"
"Treehouse"

So far so good.

This doesn't seem to work: http://play.golang.org/p/tooXqJ5Eio

time.Time field is anonymous

output is
""
""

That's odd.

This panics with a nill dereference: http://play.golang.org/p/kGoY9QA6fG

*time.Time field is anonymous (note: pointer to time.Time)

output is
panic: runtime error: invalid memory address or nil pointer dereference
[recovered]
[...]

Ouch.

Am I doing something wrong?

Thanks!

-- Larry
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 5 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedJan 6, '16 at 5:29a
activeJan 7, '16 at 12:50a
posts5
users4
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase