parseArgsDataString parses the args data and returns the values as strings. If the values cannot be represented as strings, an error is returned.
(stdin io.Reader, args []string)
| 144 | // parseArgsDataString parses the args data and returns the values as strings. |
| 145 | // If the values cannot be represented as strings, an error is returned. |
| 146 | func parseArgsDataString(stdin io.Reader, args []string) (map[string]string, error) { |
| 147 | raw, err := parseArgsData(stdin, args) |
| 148 | if err != nil { |
| 149 | return nil, err |
| 150 | } |
| 151 | |
| 152 | var result map[string]string |
| 153 | if err := mapstructure.WeakDecode(raw, &result); err != nil { |
| 154 | return nil, errors.Wrap(err, "failed to convert values to strings") |
| 155 | } |
| 156 | if result == nil { |
| 157 | result = make(map[string]string) |
| 158 | } |
| 159 | return result, nil |
| 160 | } |
| 161 | |
| 162 | // parseArgsDataStringLists parses the args data and returns the values as |
| 163 | // string lists. If the values cannot be represented as strings, an error is |
no test coverage detected
searching dependent graphs…