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
22
33.SILENT :
44
5- .PHONY : *
6-
7- .ONESHELL :
8- SHELL = bash
9- .SHELLFLAGS = -ceuo pipefail
10-
115include ci/fmt.mk
126include ci/lint.mk
137include 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
22ifdef 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
104endif
115
126modtidy : gen
@@ -23,3 +17,6 @@ prettier:
2317
2418gen :
2519 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 11FROM golang:1
22
33RUN 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
58
69ENV GOFLAGS="-mod=readonly"
7- ENV PAGER=cat
810ENV CI=true
911ENV MAKEFLAGS="--jobs=16 --output-sync=target"
1012
Original file line number Diff line number Diff line change 1- lint : govet golint
1+ lint : govet golint govet-wasm golint-wasm shellcheck
22
33govet :
44 go vet ./...
@@ -11,3 +11,6 @@ golint:
1111
1212golint-wasm :
1313 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