Commit e2a9a7f
authored
fix: Format []ByRegexOption correctly. (#118)
If there's a mix of mappings and singular elements, the mappings will
(maybe) be quoted correctly but the singular elements won't be, which
can result in a a different YAML flow sequence or even invalid YAML if
the singular element has the right special characters.
e.g. Before the changes to options.go, the test was generating a
different flow sequence with 3 elements instead of 2: `by_regex=[foo,
bar, \"\\\\b(\\\\d{2})/(\\\\d{2})/(\\\\d{4})\\\\b\":
\"${3}-${1}-${2}\"]"`
We now generate strings that include mapping braces (`{` and `}`, e.g.
`by_regex=['foo, bar', {'\b(\d{2})/(\d{2})/(\d{4})\b':
'${3}-${1}-${2}'}]`). That's less than ideal, but it's still better than
generating invalid YAML. I don't see any options in the YAML library to
turn those braces off :/ https://pkg.go.dev/gopkg.in/yaml.v31 parent b8641a2 commit e2a9a7f
2 files changed
Lines changed: 42 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
43 | 51 | | |
44 | 52 | | |
45 | 53 | | |
| |||
248 | 256 | | |
249 | 257 | | |
250 | 258 | | |
251 | | - | |
| 259 | + | |
252 | 260 | | |
253 | | - | |
| 261 | + | |
254 | 262 | | |
255 | 263 | | |
256 | | - | |
257 | | - | |
| 264 | + | |
258 | 265 | | |
259 | | - | |
| 266 | + | |
260 | 267 | | |
261 | 268 | | |
262 | 269 | | |
263 | | - | |
| 270 | + | |
264 | 271 | | |
265 | 272 | | |
266 | 273 | | |
| |||
292 | 299 | | |
293 | 300 | | |
294 | 301 | | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
295 | 306 | | |
296 | 307 | | |
297 | 308 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
234 | | - | |
235 | | - | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
236 | 254 | | |
237 | 255 | | |
238 | 256 | | |
| |||
277 | 295 | | |
278 | 296 | | |
279 | 297 | | |
280 | | - | |
| 298 | + | |
281 | 299 | | |
282 | | - | |
| 300 | + | |
283 | 301 | | |
284 | 302 | | |
285 | 303 | | |
286 | | - | |
| 304 | + | |
287 | 305 | | |
288 | 306 | | |
289 | 307 | | |
290 | 308 | | |
291 | 309 | | |
292 | 310 | | |
293 | 311 | | |
294 | | - | |
| 312 | + | |
295 | 313 | | |
296 | 314 | | |
297 | | - | |
| 315 | + | |
298 | 316 | | |
299 | 317 | | |
300 | 318 | | |
| |||
0 commit comments