|
Tobias Contreras |
at Sep 24, 2013 at 3:03 am
|
⇧ |
| |
ya, but of course an empty pointer is clear, good call
On Monday, September 23, 2013 8:59:55 PM UTC-6, Dave Cheney wrote:Empty is a difficult concept for value types.
On Tue, Sep 24, 2013 at 12:58 PM, Tobias Contreras wrote:Nice!
yup that did it
On Monday, September 23, 2013 8:56:41 PM UTC-6, Dave Cheney wrote:What happens if you define it like this ?
type Actor struct {
Name string ...
Account *Account ...
}
On Tue, Sep 24, 2013 at 12:53 PM, Tobias Contreras <tobi...@gmail.com>
wrote:
is there any plans to hide empty structs from json output?
outputting
type Actor struct {
Name string `bson:"name,omitempty" json:"name,omitempty"`
Account Account `bson:"account,omitempty"
json:"account,omitempty"`
}
type Account struct {
HomePage string `bson:"homePage,omitempty" json:"homePage,omitempty"`
Name string `bson:"name,omitempty" json:"name,omitempty"`
}
shows
"actor": {
"account": {},
"mbox": "mailto:s...@s.com",
"objectType": "Agent"
}
if account is empty, can't omitempty apply to struct?
--
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
--
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 <javascript:>.
For more options, visit
https://groups.google.com/groups/opt_out. --
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/groups/opt_out.