Skip to content

Commit 7907d52

Browse files
Utagaiskriptble
authored andcommitted
Fix Linux make (#171)
* Ensure use of bash in check_env.sh * Ensure use of bash for check-fmt; create check_fmt.sh
1 parent b7b20d0 commit 7907d52

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ build:
3535

3636
.PHONY: check-fmt
3737
check-fmt:
38-
@gofmt -l -s $(PKGS) | read; if [ $$? == 0 ]; then echo "gofmt check failed for:"; gofmt -l -s $(PKGS) | sed -e 's/^/ - /'; exit 1; fi
38+
etc/check_fmt.sh $(PKGS)
3939

4040
.PHONY: fmt
4141
fmt:

etc/check_env.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/usr/bin/env bash
22

33
if [[ ! $TOPOLOGY =~ ^(server|replica_set|sharded_cluster)$ ]]; then
44
>&2 echo "Invalid value of TOPOLOGY. TOPOLOGY must be set to one of: server, replica_set, sharded_cluster"

etc/check_fmt.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
3+
gofmt_out="$(gofmt -l -s "$@")"
4+
5+
if [[ $gofmt_out ]]; then
6+
echo "gofmt check failed for:";
7+
sed -e 's/^/ - /' <<< "$gofmt_out";
8+
exit 1;
9+
fi

0 commit comments

Comments
 (0)