100 Go Mistakes 10-16
Here we go through the rest of Chapter 2 10 - Not being aware of the possible problems with type embedding Go allows you to not only include types as fields in structs, but also to embed them. Essentially this makes the fields of the embedded/base type part of the "containers" interface. Harsanyi points out that this can lead to exposing more than you might want to, since all of the base type's fields and behaviors are exposed as part of the container. If there is reason to hide the base struct's details, rather simply include it as an unexported field and write accessors. 11 - Not using the functional options pattern I'll admit that I hadn't heard about, or consciously noticed, this pattern before now, but it's quite brilliant. An issue with positional arguments in complex functions is that having tons of arguments that are either null, or unused along certain paths, etc. is a real PITA. My own preference, when factoring out the functionality into mult...