Make illegal states unrepresentable: unions over flags, parse don't validate, smart constructors
#Name alternatives and tagged variants (Types & syntax) shows how to write a union; this entry uses unions and validated constructors to design a model in which nonsense combinations cannot be built. Go has no unions and no private constructors, but it has unexported fields: a struct such as Email{addr string} can only be built outside its package through ParseEmail, which validates. Groups of flags and optional fields become a sealed interface with one struct per valid shape (ByEmail, ByPhone, ByBoth). ParseReach turns the loose input into a Reach or an error once, at the boundary.
Complete program
Complete program.
In practice: put validated types in their own package so the unexported field actually protects them, return (T, error) from constructors, and add a panicking default to type switches over the sealed interfaces. Remember that zero values bypass every constructor: Email{} and a nil Reach can always be created.
mail.ParseAddress follows RFC 5322 and accepts forms like "Ana <ana@example.com>"; it does not check that the domain exists.
Make the zero value safe where you can (an IsZero method, or treating it as invalid) because Go cannot forbid it.