Skip to content

Iftrit v2: Boilerplate cleanup #30

@tedsuo

Description

@tedsuo

Ifrit currently does not have a version number, but let's call the current head of master v1.0.0 for the purpose of this PR. There are a set of changes – which I never got around to making while at Pivotal – which I feel could clean up the boilerplate code in main() functions that use ifrit. This code is usuallly copy/pasted around, but it may improve on-boarding and comprehension to clean it up.

  • port grouper and sigmon packages into the main ifrit package. the additional package names create confusion when reading code, and they are almost always used together.
  • create a ifrit.Main method which wraps up the most common setup for ifrit into a single function.
  • allow nil members.
  • create an ifrit.EventListener interface (at least for use in ifrit.Main), which allows logging boilerplate to be shared.
  • write proper intro docs ;)
  • possibly there are other cleanups which could be included in the same push.

Example of the above changes being applied:
https://gist.github.com/tedsuo/1e99de0d465330526ff2

Personally, I find the end result to be much more readable.

By porting the new functionality to the main package, ifrit could remain backwards compatible simply by leaving the current packages alone.

@nimakaviani @jvshahid @emalm since y’all make the heaviest use of ifrit, let me know if this of interest.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions