Golang - functional options pattern
In the previous article we discussed the Builder pattern. There we noticed a drawback that we can't perform validation when assigning parameters. As a result, we are deprived of the ability to build a chain of methods. Let's look at another more interesting pattern - Functional options. There are different implementations with slight differences, but the basic idea is as follows