func NewStatusPolicy(statuses []Status) (*statusPolicy, error) {
	newPol := make(statusPolicy)
	for i, status := range statuses {
		newPol[status] = statusSeverity(i)
	}
	defaultPol := NewDefaultStatusPolicy()
	for status := range *defaultPol {
		_, ok := newPol[status]
		if !ok {
			return nil, fmt.Errorf("missing status: %v", status)
		}
	}
	return &newPol, nil
}
NewStatusPolicy returns a status policy that assigns relative
severity in accordance with a user-configurable prioritised slice.
Check statuses must be listed in ascending severity order.
package nagiosplugin
import "fmt"
type Status uint
const (
	OK Status = iota
	WARNING
	CRITICAL
	UNKNOWN
)
type (
	statusSeverity uint
	statusPolicy   map[Status]statusSeverity
)
func NewDefaultStatusPolicy() *statusPolicy {
	return &statusPolicy{
		OK:       statusSeverity(OK),
		WARNING:  statusSeverity(WARNING),
		CRITICAL: statusSeverity(CRITICAL),
		UNKNOWN:  statusSeverity(UNKNOWN),
	}
}
func NewOUWCStatusPolicy() *statusPolicy {
	pol, _ := NewStatusPolicy([]Status{OK, UNKNOWN, WARNING, CRITICAL})
	return pol
}