Re:Show HN: Defaults – Simple default values in go structs
by nvader on Saturday January 23, 2016 @08:44PM
(#10961086)
My practice has usually been to ensure that the zero values of the types ARE a sane default for a struct if that struct is public and may be instantiated by a client. It sometimes involves flipping the semantics of some Boolean values around.
That, and judicious use of a New() function to construct and initialize types, help make up for the lack of default attributes in structs.
That, and judicious use of a New() function to construct and initialize types, help make up for the lack of default attributes in structs.