mirror of
https://github.com/yannh/kubeconform.git
synced 2026-02-18 09:27:02 +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
|
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)
|
fmt.Fprintln(os.Stderr, err)
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package output
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"io"
|
||||||
|
|
||||||
"github.com/yannh/kubeconform/pkg/validator"
|
"github.com/yannh/kubeconform/pkg/validator"
|
||||||
)
|
)
|
||||||
|
|
@ -12,9 +12,7 @@ type Output interface {
|
||||||
Flush() error
|
Flush() error
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(outputFormat string, printSummary, isStdin, verbose bool) (Output, error) {
|
func New(w io.Writer, outputFormat string, printSummary, isStdin, verbose bool) (Output, error) {
|
||||||
w := os.Stdout
|
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case outputFormat == "json":
|
case outputFormat == "json":
|
||||||
return jsonOutput(w, printSummary, isStdin, verbose), nil
|
return jsonOutput(w, printSummary, isStdin, verbose), nil
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue