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