ci/check_go_mod.sh
raw| 1 | #!/bin/bash |
| 2 | # This script is used to ensure that the go.mod file is up to date. |
| 3 | |
| 4 | set -euo pipefail |
| 5 | |
| 6 | for i in $(find $PWD -name go.mod); do |
| 7 | pushd $(dirname $i) |
| 8 | go mod tidy |
| 9 | popd |
| 10 | done |
| 11 | |
| 12 | if [ ! -z "$(git status --porcelain)" ]; then |
| 13 | git status |
| 14 | git diff |
| 15 | echo |
| 16 | echo "The go.mod is not up to date." |
| 17 | exit 1 |
| 18 | fi |