I'd like to be able to instantiate this struct, but I'm unsure how to do this. At the moment I'm getting a "missing type in composite literal" error — but short of creating an additional type, I'm not sure how to name this anonymous struct.
Is what I'm trying to do possible?
Torrance
Dave Cheney
unread,
Sep 14, 2013, 1:22:22 AM9/14/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
> --
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
Torrance Hodgson
unread,
Sep 14, 2013, 1:25:53 AM9/14/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golan...@googlegroups.com, Torrance Hodgson
Thanks - that's the solution I'd just come to. It's a bit verbose and will soon get very non-DRY, so I might as well name the inner struct.
Torrance
Dave Cheney
unread,
Sep 14, 2013, 1:33:27 AM9/14/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Torrance Hodgson, golang-nuts
Yeah, every time I have tried this, usually in a test, the verbosity
quickly drives me towards declaring a new struct. It can be done with
inline anon declarations, but the readability hit rarely justifies the
cleverness.