func()

in packages/package.go [464:484]


func (p *Package) HasCompatibleSpec(specMin, specMax, kibanaVersion *semver.Version) (bool, error) {
	if specMin == nil && specMax == nil {
		return true, nil
	}

	constraints := []string{}
	if specMin != nil {
		constraints = append(constraints, fmt.Sprintf(">=%s", specMin.String()))
	}
	if specMax != nil {
		constraints = append(constraints, fmt.Sprintf("<=%s", specMax.String()))
	}

	fullConstraint := strings.Join(constraints, ",")
	constraint, err := semver.NewConstraint(fullConstraint)
	if err != nil {
		return false, fmt.Errorf("cannot create constraint %s: %w", fullConstraint, err)
	}

	return constraint.Check(p.specMajorMinorSemVer), nil
}