Browse Source

githooks: add a githook to check that the test-plans go.mod is tidied (#2256)

pull/2266/head
Marten Seemann 2 years ago
committed by GitHub
parent
commit
66a6dc9a55
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      .githooks/README.md
  2. 13
      .githooks/pre-commit

8
.githooks/README.md

@ -0,0 +1,8 @@
# Git Hooks
This directory contains useful Git hooks for working with go-libp2p.
Install them by running
```bash
git config core.hooksPath .githooks
```

13
.githooks/pre-commit

@ -0,0 +1,13 @@
#!/bin/bash
pushd ./test-plans > /dev/null
go mod tidy
if [[ -n $(git diff --name-only -- "go.mod" "go.sum") ]]; then
echo "go.mod / go.sum in test-plans not tidied"
errored=true
fi
popd > /dev/null
if [ "$errored" = true ]; then
exit 1
fi
Loading…
Cancel
Save