Skip to content

Commit

Permalink
Do not hardcode output stream in pkg/output
Browse files Browse the repository at this point in the history
Co-authored-by: Ahmed AbouZaid <6760103+aabouzaid@users.noreply.github.com>
  • Loading branch information
yannh and aabouzaid committed Apr 23, 2023
1 parent 8bc9f42 commit d038bf8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cmd/kubeconform/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func realMain() int {
}

var o output.Output
if o, err = output.New(cfg.OutputFormat, cfg.Summary, useStdin, cfg.Verbose); err != nil {
if o, err = output.New(os.Stdout, cfg.OutputFormat, cfg.Summary, useStdin, cfg.Verbose); err != nil {
fmt.Fprintln(os.Stderr, err)
return 1
}
Expand Down
6 changes: 2 additions & 4 deletions pkg/output/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package output

import (
"fmt"
"os"
"io"

"github.com/yannh/kubeconform/pkg/validator"
)
Expand All @@ -12,9 +12,7 @@ type Output interface {
Flush() error
}

func New(outputFormat string, printSummary, isStdin, verbose bool) (Output, error) {
w := os.Stdout

func New(w io.Writer, outputFormat string, printSummary, isStdin, verbose bool) (Output, error) {
switch {
case outputFormat == "json":
return jsonOutput(w, printSummary, isStdin, verbose), nil
Expand Down

0 comments on commit d038bf8

Please sign in to comment.