(attrs map[string]*api.AttrValue, key string)
| 571 | } |
| 572 | |
| 573 | func lookupAttrCaseInsensitive(attrs map[string]*api.AttrValue, key string) (*api.AttrValue, bool) { |
| 574 | if value, ok := attrs[key]; ok { |
| 575 | return value, true |
| 576 | } |
| 577 | |
| 578 | for actualKey, value := range attrs { |
| 579 | if equalFoldTrim(actualKey, key) { |
| 580 | return value, true |
| 581 | } |
| 582 | } |
| 583 | |
| 584 | return nil, false |
| 585 | } |
| 586 | |
| 587 | func equalFoldTrim(a, b string) bool { |
| 588 | return strings.EqualFold(strings.TrimSpace(a), strings.TrimSpace(b)) |
no test coverage detected