mirror of
https://github.com/yannh/kubeconform.git
synced 2026-02-11 14:09:21 +00:00
32 lines
433 B
Go
32 lines
433 B
Go
package output
|
|
|
|
import (
|
|
"github.com/yannh/kubeconform/pkg/validator"
|
|
)
|
|
|
|
const (
|
|
VALID = iota
|
|
INVALID
|
|
ERROR
|
|
SKIPPED
|
|
)
|
|
|
|
type Output interface {
|
|
Write(filename, kind, version string, err error, skipped bool)
|
|
Flush()
|
|
}
|
|
|
|
func status(err error, skipped bool) int {
|
|
if skipped {
|
|
return SKIPPED
|
|
}
|
|
|
|
if err != nil {
|
|
if _, ok := err.(validator.InvalidResourceError); ok {
|
|
return INVALID
|
|
}
|
|
return ERROR
|
|
}
|
|
|
|
return VALID
|
|
}
|