Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a SummaryBuilder and add Formats #104

Closed
reaandrew opened this issue Jan 28, 2017 · 0 comments
Closed

Create a SummaryBuilder and add Formats #104

reaandrew opened this issue Jan 28, 2017 · 0 comments
Assignees

Comments

@reaandrew
Copy link
Member

Currently we have JSON and YAML concerns inside of core:

  //SummaryBuilder ...
  type SummaryBuilder interface {
      Write(summary ExecutionSummary)
  }

  //NewSummaryBuilder ...
  func NewSummaryBuilder(format string) SummaryBuilder {
      switch format {
      case "json":
          return &JSONSummaryBuilder{
              writer: os.Stdout,
          }
      case "yaml":
          return &YAMLSummaryBuilder{
              writer: os.Stdout,
          }
      default:
          return NewConsoleSummaryBuilder(os.Stdout)
      }
  }

Instead of this and to keep core clear of any details of format it would be better to have a method called AddFormat(name string, builder SummaryBuilder) . The correct builder would then be looked up from a map at time of execution. The JSONSummaryBuilder would live in a JSON package inside of the serialisation package and the YAMLSummaryBuilder inside the yaml package.

I missed this on the review of #103

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants