mirror of
https://github.com/yannh/kubeconform.git
synced 2026-02-11 14:09:21 +00:00
Do not hardcode output stream in pkg/output
Co-authored-by: Ahmed AbouZaid <6760103+aabouzaid@users.noreply.github.com>
This commit is contained in:
parent
8bc9f42f39
commit
d038bf8840
2 changed files with 3 additions and 5 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package output
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"io"
|
||||
|
||||
"github.com/yannh/kubeconform/pkg/validator"
|
||||
)
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue