File: check_go_mod.sh

package info (click to toggle)
golang-github-golang-mock 1.6.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-backports, forky, sid, trixie
  • size: 800 kB
  • sloc: sh: 58; makefile: 3
file content (18 lines) | stat: -rwxr-xr-x 333 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash
# This script is used to ensure that the go.mod file is up to date.

set -euo pipefail

for i in $(find $PWD -name go.mod); do
    pushd $(dirname $i)
    go mod tidy
    popd
done 

if [ ! -z "$(git status --porcelain)" ]; then
    git status
    git diff
    echo
    echo "The go.mod is not up to date."
    exit 1
fi