@@ -34,9 +34,9 @@ const (
3434EntitlementNotEntitled Entitlement = "not_entitled"
3535)
3636
37- //entitlementWeight converts the enum types to a numerical value for easier
37+ //Weight converts the enum types to a numerical value for easier
3838// comparisons. Easier than sets of if statements.
39- func entitlementWeight (e Entitlement )int {
39+ func (e Entitlement ) Weight ( )int {
4040switch e {
4141case EntitlementEntitled :
4242return 2
@@ -193,7 +193,7 @@ func CompareFeatures(a, b Feature) int {
193193// feature can be "greater" than an entitled.
194194// If either is "NotEntitled" then we can defer to a strict entitlement
195195// check.
196- if entitlementWeight ( a .Entitlement )>= 0 && entitlementWeight ( b .Entitlement )>= 0 {
196+ if a .Entitlement . Weight ( )>= 0 && b .Entitlement . Weight ( )>= 0 {
197197if a .Capable ()&& ! b .Capable () {
198198return 1
199199}
@@ -204,7 +204,7 @@ func CompareFeatures(a, b Feature) int {
204204}
205205
206206// Strict entitlement check. Higher is better
207- entitlementDifference := entitlementWeight ( a .Entitlement )- entitlementWeight ( b .Entitlement )
207+ entitlementDifference := a .Entitlement . Weight ( )- b .Entitlement . Weight ( )
208208if entitlementDifference != 0 {
209209return entitlementDifference
210210}