Commit 402b0bd
committed
fix: use compact indent for sequences
We had some grumbles from developers after the goyaml.v3 upgrade that
this changed the sequence indent used by kustomize, kubectl etc.
There was a whole thread about this when the goyaml.v3 upgrade happened
in kustomize itself: kubernetes-sigs/kustomize#3946
and the result was that kubesigs forked goyaml.
In order to more closely match what the kubernetes tools do, this commit
switches to the forked version, which has a compact option on the
encoder:
https://github.com/kubernetes-sigs/yaml/blob/56d672052dcff7362af5b66f6424976539cddd78/goyaml.v3/patch.go#L25-L28
When I first tried this I also changed the code to guess if compact
was the preferred style from the yaml. However, it turns out that
the yaml formatter misbehaves when told to use "compact" and an indent
other than 2; if set to 3 and compact it produces code like this:
mapping:
- list item
Instead of:
mapping:
- list item
This meant I couldn't get the "guess indentation" code to work, so
I've removed that and its test to avoid raising a fault expectation.
Signed-off-by: Brian Ewins <[email protected]>1 parent 3448312 commit 402b0bd
3 files changed
+55
-140
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| 156 | + | |
156 | 157 | | |
157 | 158 | | |
158 | 159 | | |
| |||
167 | 168 | | |
168 | 169 | | |
169 | 170 | | |
170 | | - | |
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
| |||
425 | 427 | | |
426 | 428 | | |
427 | 429 | | |
| 430 | + | |
428 | 431 | | |
429 | 432 | | |
430 | 433 | | |
| |||
434 | 437 | | |
435 | 438 | | |
436 | 439 | | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | 440 | | |
462 | 441 | | |
463 | 442 | | |
| |||
481 | 460 | | |
482 | 461 | | |
483 | 462 | | |
484 | | - | |
| 463 | + | |
485 | 464 | | |
486 | 465 | | |
487 | 466 | | |
488 | 467 | | |
489 | | - | |
| 468 | + | |
490 | 469 | | |
491 | 470 | | |
492 | 471 | | |
493 | | - | |
| 472 | + | |
494 | 473 | | |
495 | 474 | | |
496 | 475 | | |
| |||
504 | 483 | | |
505 | 484 | | |
506 | 485 | | |
507 | | - | |
508 | 486 | | |
509 | 487 | | |
510 | 488 | | |
| |||
546 | 524 | | |
547 | 525 | | |
548 | 526 | | |
549 | | - | |
| 527 | + | |
550 | 528 | | |
551 | 529 | | |
552 | 530 | | |
| |||
559 | 537 | | |
560 | 538 | | |
561 | 539 | | |
562 | | - | |
| 540 | + | |
563 | 541 | | |
564 | 542 | | |
565 | 543 | | |
566 | 544 | | |
567 | | - | |
| 545 | + | |
568 | 546 | | |
569 | 547 | | |
570 | 548 | | |
571 | | - | |
| 549 | + | |
572 | 550 | | |
573 | 551 | | |
574 | 552 | | |
| |||
0 commit comments