File tree Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,15 @@ RUN mkdir -p /usr/src/criu \
3636 && cd /usr/src/criu \
3737 && make install-criu
3838
39+ # install shfmt
40+ RUN mkdir -p /go/src/github.com/mvdan \
41+ && cd /go/src/github.com/mvdan \
42+ && git clone https://github.com/mvdan/sh \
43+ && cd sh \
44+ && git checkout -f v0.4.0 \
45+ && go install ./cmd/shfmt \
46+ && rm -rf /go/src/github.com/mvdan
47+
3948# setup a playground for us to spawn containers in
4049ENV ROOTFS /busybox
4150RUN mkdir -p ${ROOTFS} \
Original file line number Diff line number Diff line change @@ -119,6 +119,7 @@ clean:
119119
120120validate :
121121 script/validate-gofmt
122+ script/validate-shfmt
122123 go vet ./...
123124
124125ci : validate localtest
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ badFiles=()
4+ while read f; do
5+ badFiles+=(" $f " )
6+ done < <( shfmt -l . | grep -v Godeps/)
7+
8+ if [ ${# badFiles[@]} -eq 0 ]; then
9+ echo ' Congratulations! All shell source files are properly formatted.'
10+ else
11+ {
12+ echo " These files are not properly shfmt'd:"
13+ for f in " ${badFiles[@]} " ; do
14+ echo " - $f "
15+ done
16+ echo
17+ echo ' Please reformat the above files using "shfmt -w" and commit the result.'
18+ echo
19+ } >&2
20+ false
21+ fi
You can’t perform that action at this time.
0 commit comments