2021-04-03 17:49:18 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2021-09-23 19:59:40 +02:00
|
|
|
gofiles=$(git diff --cached --name-only --diff-filter=ACM | grep --silent '.go$')
|
2021-04-03 17:49:18 +02:00
|
|
|
[ -z "$gofiles" ] && exit 0
|
|
|
|
|
|
|
|
# Automatically format go code, exit on error
|
|
|
|
echo "Formatting staged go files"
|
|
|
|
gofmt -w $gofiles
|