Creating and managing Graph instances

Our graph processing system is nearly complete! To finalize our implementation, we need to define a constructor that will create new Graph instances and some auxiliary methods that will manage the graph's life cycle.

As we saw in the previous sections, there are quite a few knobs for configuring Graph instances. Passing each individual configuration option as an argument to the graph's constructor is considered to be an anti-pattern – not to mention that we would have to bump the major version of our package every time we want to add a new configuration option; changing a constructor's signature is the very definition of a breaking change!

A much better solution is to define a typed configuration object ...

Get Hands-On Software Engineering with Golang now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.