func Or(a, b ObjectLinterFn) ObjectLinterFn {
	return func(o runtime.Object) error {
		if a == nil || b == nil {
			return errors.New(errNilLinterFn)
		}
		aErr := a(o)
		bErr := b(o)
		if aErr == nil || bErr == nil {
			return nil
		}
		return errors.Errorf(errOrFmt, aErr, bErr)
	}
}
Or checks that at least one of the passed linter functions does not return an
error.
package parser
import (
	"k8s.io/apimachinery/pkg/runtime"
	"github.com/crossplane/crossplane-runtime/pkg/errors"
)
const (
	errNilLinterFn = "linter function is nil"
	errOrFmt = "object did not pass either check: (%v), (%v)"
)
type Linter interface {
	Lint(*Package) error
}
type PackageLinterFn func(*Package) error
func PackageLinterFns(fns ...PackageLinterFn) []PackageLinterFn {
	return fns
}
type ObjectLinterFn func(runtime.Object) error
func ObjectLinterFns(fns ...ObjectLinterFn) []ObjectLinterFn {
	return fns
}
type PackageLinter struct {
	pre       []PackageLinterFn
	perMeta   []ObjectLinterFn
	perObject []ObjectLinterFn
}
func NewPackageLinter(pre []PackageLinterFn, perMeta, perObject []ObjectLinterFn) *PackageLinter {
	return &PackageLinter{
		pre:       pre,
		perMeta:   perMeta,
		perObject: perObject,
	}
}
func (l *PackageLinter) Lint(pkg *Package) error {
	for _, fn := range l.pre {
		if err := fn(pkg); err != nil {
			return err
		}
	}
	for _, o := range pkg.GetMeta() {
		for _, fn := range l.perMeta {
			if err := fn(o); err != nil {
				return err
			}
		}
	}
	for _, o := range pkg.GetObjects() {
		for _, fn := range l.perObject {
			if err := fn(o); err != nil {
				return err
			}
		}
	}
	return nil
}