(content []byte, column string)
| 145 | } |
| 146 | |
| 147 | func extractCSVColumn(content []byte, column string) ([]string, error) { |
| 148 | table, err := tabular.Parse(content) |
| 149 | if err != nil { |
| 150 | return nil, fmt.Errorf("parsing CSV policy input file: %w", err) |
| 151 | } |
| 152 | |
| 153 | values, ok := table.Column(column) |
| 154 | if !ok { |
| 155 | return nil, fmt.Errorf("column %q not found in CSV header %v", column, table.Header) |
| 156 | } |
| 157 | |
| 158 | return values, nil |
| 159 | } |
| 160 | |
| 161 | // extractJSONColumn extracts column values from one of three accepted shapes: |
| 162 | // a bare array of strings, an array of string-valued objects (the column field |
no test coverage detected