(v Values, simple string)
| 82 | } |
| 83 | |
| 84 | func tableLookup(v Values, simple string) (Values, error) { |
| 85 | v2, ok := v[simple] |
| 86 | if !ok { |
| 87 | return v, ErrNoTable{simple} |
| 88 | } |
| 89 | if vv, ok := v2.(map[string]any); ok { |
| 90 | return vv, nil |
| 91 | } |
| 92 | |
| 93 | // This catches a case where a value is of type Values, but doesn't (for some |
| 94 | // reason) match the map[string]interface{}. This has been observed in the |
| 95 | // wild, and might be a result of a nil map of type Values. |
| 96 | if vv, ok := v2.(Values); ok { |
| 97 | return vv, nil |
| 98 | } |
| 99 | |
| 100 | return Values{}, ErrNoTable{simple} |
| 101 | } |
| 102 | |
| 103 | // ReadValues will parse YAML byte data into a Values. |
| 104 | func ReadValues(data []byte) (vals Values, err error) { |
no outgoing calls
no test coverage detected
searching dependent graphs…