File tree Expand file tree Collapse file tree 5 files changed +36
-17
lines changed Expand file tree Collapse file tree 5 files changed +36
-17
lines changed Original file line number Diff line number Diff line change @@ -2,12 +2,6 @@ all: fmt lint test
2
2
3
3
.SILENT :
4
4
5
- .PHONY : *
6
-
7
- .ONESHELL :
8
- SHELL = bash
9
- .SHELLFLAGS = -ceuo pipefail
10
-
11
5
include ci/fmt.mk
12
6
include ci/lint.mk
13
7
include ci/test.mk
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+
5
+ main () {
6
+ local files
7
+ mapfile -t files < <( git ls-files --other --modified --exclude-standard)
8
+ if [[ ${files[*]} == " " ]]; then
9
+ return
10
+ fi
11
+
12
+ echo " Files need generation or are formatted incorrectly:"
13
+ for f in " ${files[@]} " ; do
14
+ echo " $f "
15
+ done
16
+
17
+ echo
18
+ echo " Please run the following locally:"
19
+ echo " make fmt"
20
+ exit 1
21
+ }
22
+
23
+ main " $@ "
Original file line number Diff line number Diff line change 1
- fmt : modtidy gofmt goimports prettier
1
+ fmt : modtidy gofmt goimports prettier shfmt
2
2
ifdef CI
3
- if [[ $$(git ls-files --other --modified --exclude-standard) != "" ]]; then
4
- echo "Files need generation or are formatted incorrectly:"
5
- git -c color.ui=always status | grep --color=no '\e\[31m'
6
- echo "Please run the following locally:"
7
- echo " make fmt"
8
- exit 1
9
- fi
3
+ ./ci/ensure_fmt.sh
10
4
endif
11
5
12
6
modtidy : gen
@@ -23,3 +17,6 @@ prettier:
23
17
24
18
gen :
25
19
stringer -type=opcode,MessageType,StatusCode -output=stringer.go
20
+
21
+ shfmt :
22
+ shfmt -i 2 -w -s -sr $$(git ls-files "*.sh" )
Original file line number Diff line number Diff line change 1
1
FROM golang:1
2
2
3
3
RUN apt-get update
4
- RUN apt-get install -y chromium npm
4
+ RUN apt-get install -y chromium npm shellcheck
5
+
6
+ ARG SHFMT_URL=https://github.com/mvdan/sh/releases/download/v3.0.1/shfmt_v3.0.1_linux_amd64
7
+ RUN curl -L $SHFMT_URL > /usr/local/bin/shfmt && chmod +x /usr/local/bin/shfmt
5
8
6
9
ENV GOFLAGS="-mod=readonly"
7
- ENV PAGER=cat
8
10
ENV CI=true
9
11
ENV MAKEFLAGS="--jobs=16 --output-sync=target"
10
12
Original file line number Diff line number Diff line change 1
- lint : govet golint
1
+ lint : govet golint govet-wasm golint-wasm shellcheck
2
2
3
3
govet :
4
4
go vet ./...
@@ -11,3 +11,6 @@ golint:
11
11
12
12
golint-wasm :
13
13
GOOS=js GOARCH=wasm golint -set_exit_status ./...
14
+
15
+ shellcheck :
16
+ shellcheck $$(git ls-files "*.sh" )
You can’t perform that action at this time.
0 commit comments