Introduce MustConstraints()
Radek Simko
2 years ago
65 | 65 | return Constraints(result), nil |
66 | 66 | } |
67 | 67 | |
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 | ||
68 | 78 | // Check tests if a version satisfies all the constraints. |
69 | 79 | func (cs Constraints) Check(v *Version) bool { |
70 | 80 | for _, c := range cs { |