Codebase list golang-github-hashicorp-go-version / 43df615
Introduce MustConstraints() Radek Simko 2 years ago
1 changed file(s) with 10 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
6565 return Constraints(result), nil
6666 }
6767
68 // MustConstraints is a helper that wraps a call to a function
69 // returning (Constraints, error) and panics if error is non-nil.
70 func MustConstraints(c Constraints, err error) Constraints {
71 if err != nil {
72 panic(err)
73 }
74
75 return c
76 }
77
6878 // Check tests if a version satisfies all the constraints.
6979 func (cs Constraints) Check(v *Version) bool {
7080 for _, c := range cs {