Skip to content

Commit 5778041

Browse files
authored
Use pipefail to fix exit code (#847)
1 parent d2e09ef commit 5778041

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,16 @@ install-git-hooks:
66
chmod +x .git/hooks/pre-push
77

88
.PHONY: pre-commit
9-
pre-commit:
10-
make lint-fix
9+
pre-commit: lint-fix
1110

1211
.PHONY: pre-push
1312
pre-push:
1413
make -C src test
1514

1615
.PHONY: lint
1716
lint:
18-
cd src && golangci-lint run
17+
make -C src lint
1918

2019
.PHONY: lint-fix
2120
lint-fix:
22-
cd src && golangci-lint run --fix
21+
make -C src lint-fix

src/Makefile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ install: $(BINARY_NAME)
2020
.PHONY: test
2121
test: $(PROTOS)
2222
go mod tidy
23-
go test -test.short ./... | sed -e 's/\(--- FAIL.*\)/[0;31m\1[0m/g'
23+
set -o pipefail ; go test -test.short ./... | sed -e 's/\(--- FAIL.*\)/[0;31m\1[0m/g'
2424

2525
.PHONY: integ
2626
integ: $(PROTOS)
27-
go test -v -tags=integration ./... | sed -e 's/\(--- FAIL.*\)/[0;31m\1[0m/g'
27+
set -o pipefail ; go test -v -tags=integration ./... | sed -e 's/\(--- FAIL.*\)/[0;31m\1[0m/g'
2828

2929
.PHONY: linux-amd64
3030
linux-amd64: test
@@ -61,3 +61,11 @@ pull:
6161
release: pull test no-diff
6262
git tag $$(git tag -l 'v*' --sort=-v:refname | head -n1 | awk -F. '{$$NF = $$NF + 1;} 1' OFS=.)
6363
git push --follow-tags --tags
64+
65+
.PHONY: lint
66+
lint:
67+
golangci-lint run
68+
69+
.PHONY: lint-fix
70+
lint-fix:
71+
golangci-lint run --fix

0 commit comments

Comments
 (0)