tcping
tcping copied to clipboard
Functional Options Pattern for initializing tcping
Currently, the initialization of tcping instances occurs through a method called processUserInput, which directly modifies the fields of a tcping struct based on command-line flags and other input parameters. This method has grown to become complex and handles multiple aspects of the setup, which impacts maintainability and testability.
We aim to refactor this initialization routine by implementing the Functional Options Pattern, in which the tcping initialization is broken down into a series of small functions, each with a single responsibility: configuring a specific aspect of the tcping instance.
https://golang.cafe/blog/golang-functional-options-pattern.html