Debian Codegraph @

script/fmt

raw symbols SCIP
1 #!/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=$(find . -name '*.go' -not -path '*/stadtx/*')
8
9 # Remove blank lines in import blocks. This will force formatting to group
10 # imports correctly.
11 sed -i.fmtbackup '/^import (/,/)/ { /^[ \t]*$/ d; }' ${files}
12 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 find . -name '*.yml' | xargs yamlfmt -w