▲ | maleldil 3 days ago | ||||||||||||||||||||||||||||||||||
Not in Go. Empty slices and empty maps are nil, so it's ambiguous. | |||||||||||||||||||||||||||||||||||
▲ | rowanseymour 2 days ago | parent | next [-] | ||||||||||||||||||||||||||||||||||
To be precise.. empty slices and maps sometimes behave like nil (len, range etc) and sometimes not (inserting into a nil map). The former is a neat convenience, and I think extending that to JSON marshaling makes sense. | |||||||||||||||||||||||||||||||||||
▲ | stackedinserter 2 days ago | parent | prev [-] | ||||||||||||||||||||||||||||||||||
No, empty slices and empty maps in Go are not nil. | |||||||||||||||||||||||||||||||||||
|