Skip to content

Commit b128335

Browse files
committed
Makefile: rm .SHELLFLAGS, add set -e
Apparently GHA CI Mac OS X environment uses old GNU Make (v3.81) which does not yes support .SHELLFLAGS (added by commit 8589e2e). Since we call a few commands (under "for") from the make target, intermediate failures are ignored unless "-e" shell option is set (or explicit "&&" is used, which is not possible to do in "for"). Example: for cmd in false true; do $cmd; done This code succeeds (has exit code of 0), unless "set -e" is set, because the last command executed is "true" with the exit code of 0. Use explicit "set -e" where needed. While at it, also add "-u" to catch possible uses of uninitialized variables. Also, replace && with ; for multiple commands. Technically this is not required for the fix, but since having set -e results in implicit &&, there is no need to have && explicitly. In other words, this change is more like a reminder that we do not have to use && here. Fixes: 8589e2e Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent d4611de commit b128335

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Diff for: Makefile

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
.SHELLFLAGS = -ec
21
PACKAGES ?= mountinfo mount signal symlink
32
BINDIR ?= _build/bin
43
CROSS ?= linux/arm linux/arm64 linux/ppc64le linux/s390x \
@@ -15,8 +14,9 @@ clean:
1514

1615
.PHONY: test
1716
test: test-local
17+
set -eu; \
1818
for p in $(PACKAGES); do \
19-
(cd $$p && go test $(RUN_VIA_SUDO) -v .); \
19+
(cd $$p; go test $(RUN_VIA_SUDO) -v .); \
2020
done
2121

2222
# Test the mount module against the local mountinfo source code instead of the
@@ -33,9 +33,11 @@ test-local:
3333
.PHONY: lint
3434
lint: $(BINDIR)/golangci-lint
3535
$(BINDIR)/golangci-lint version
36+
set -eu; \
3637
for p in $(PACKAGES); do \
37-
(cd $$p && go mod download \
38-
&& ../$(BINDIR)/golangci-lint run); \
38+
(cd $$p; \
39+
go mod download; \
40+
../$(BINDIR)/golangci-lint run); \
3941
done
4042

4143
$(BINDIR)/golangci-lint: $(BINDIR)
@@ -46,10 +48,11 @@ $(BINDIR):
4648

4749
.PHONY: cross
4850
cross:
51+
set -eu; \
4952
for osarch in $(CROSS); do \
5053
export GOOS=$${osarch%/*} GOARCH=$${osarch#*/}; \
5154
echo "# building for $$GOOS/$$GOARCH"; \
5255
for p in $(PACKAGES); do \
53-
(cd $$p && go build .); \
56+
(cd $$p; go build .); \
5457
done; \
5558
done

0 commit comments

Comments
 (0)