| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. -ex |
| 2 | |
| 3 | repo="github.com/mmcloughlin/avo" |
| 4 | |
| 5 | # Files to apply formatting to. Exclude stadtx since some of it was imported |
| 6 | # from the original repo. |
| 7 | files=$(findscip-shell system . . find. . -name '*.go' -not -path '*/stadtx/*') |
| 8 | |
| 9 | # Remove blank lines in import blocks. This will force formatting to group |
| 10 | # imports correctly. |
| 11 | sedscip-shell system . . sed. -i.fmtbackup '/^import (/,/)/ { /^[ \t]*$/ d; }scip-shell filesystem . . `/^import (/,/)/ { /^[ \t]*$/ d; }`.' ${files} |
| 12 | findscip-shell system . . find. . -name '*.fmtbackup' -delete |
| 13 | |
| 14 | # goimports for import grouping. |
| 15 | goimports -w -local "${repo}" ${files} |
| 16 | |
| 17 | # gofumpt for stricter gofmt-compatible format. |
| 18 | gofumpt -w ${files} |
| 19 | |
| 20 | # yaml formatting. |
| 21 | findscip-shell system . . find. . -name '*.yml' | xargsscip-shell system . . xargs. yamlfmt -w |