(values []ValueInterface)
| 163 | } |
| 164 | |
| 165 | func getMax(values []ValueInterface) (ValueInterface, error) { |
| 166 | if len(values) == 0 { |
| 167 | return nil, errors.New("can't extract max from empty array") |
| 168 | } |
| 169 | |
| 170 | maxValue := values[0] |
| 171 | for _, value := range values[1:] { |
| 172 | if value.isGreaterThan(maxValue) { |
| 173 | maxValue = value |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | return maxValue, nil |
| 178 | } |
no test coverage detected