ergo/.check-gofmt.sh

15 lines
263 B
Bash
Raw Permalink Normal View History

2018-04-23 02:36:50 +02:00
#!/bin/bash
# exclude vendor/
2021-05-25 06:34:38 +02:00
SOURCES="./ergo.go ./irc"
2018-04-23 02:36:50 +02:00
2020-06-17 08:14:23 +02:00
if [ "$1" = "--fix" ]; then
exec gofmt -s -w $SOURCES
fi
2018-04-23 02:36:50 +02:00
if [ -n "$(gofmt -s -l $SOURCES)" ]; then
echo "Go code is not formatted correctly with \`gofmt -s\`:"
gofmt -s -d $SOURCES
exit 1
fi