mirror of
https://github.com/libp2p/go-libp2p.git
synced 2025-09-26 20:21:26 +08:00
githooks: add a githook to check that the test-plans go.mod is tidied (#2256)
This commit is contained in:
8
.githooks/README.md
Normal file
8
.githooks/README.md
Normal file
@@ -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
Executable file
13
.githooks/pre-commit
Executable file
@@ -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
|
Reference in New Issue
Block a user