Get finds the first value in the Include statement matching the alias and the given key.
(alias, key string)
| 729 | // Get finds the first value in the Include statement matching the alias and the |
| 730 | // given key. |
| 731 | func (inc *Include) Get(alias, key string) string { |
| 732 | inc.mu.Lock() |
| 733 | defer inc.mu.Unlock() |
| 734 | // TODO: we search files in any order which is not correct |
| 735 | for i := range inc.matches { |
| 736 | cfg := inc.files[inc.matches[i]] |
| 737 | if cfg == nil { |
| 738 | panic("nil cfg") |
| 739 | } |
| 740 | val, err := cfg.Get(alias, key) |
| 741 | if err == nil && val != "" { |
| 742 | return val |
| 743 | } |
| 744 | } |
| 745 | return "" |
| 746 | } |
| 747 | |
| 748 | // GetAll finds all values in the Include statement matching the alias and the |
| 749 | // given key. |