1
0
Fork 0
mirror of https://github.com/matrix-org/gomatrix synced 2025-05-12 18:44:55 +00:00
gomatrix/hooks/pre-commit
Neil Alexander e5578b12c7
Run CI using golangci-lint, Go 1.13.10 (#78)
* Run CI using golangci-lint, Go 1.13.10

* Update pre-commit hook

* Fix lint issues
2020-05-01 13:17:22 +01:00

19 lines
453 B
Bash
Executable file

#! /bin/bash
set -eu
# gofmt doesn't exit with an error code if the files don't match the expected
# format. So we have to run it and see if it outputs anything.
if gofmt -l -s . 2>&1 | read
then
echo "Error: not all code had been formatted with gofmt."
echo "Fixing the following files"
gofmt -s -w -l .
echo
echo "Please add them to the commit"
git status --short
exit 1
fi
golangci-lint run
go test -timeout 5s . ./...