File: check_go_fmt.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 (12 lines) | stat: -rwxr-xr-x 310 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/bash
# This script is used by the CI to check if the code is gofmt formatted.

set -euo pipefail

GOFMT_DIFF=$(IFS=$'\n'; gofmt -d $( find . -type f -name '*.go' ) )
if [[ -n "${GOFMT_DIFF}" ]]; then
    echo "${GOFMT_DIFF}"
    echo
    echo "The go source files aren't gofmt formatted."
    exit 1
fi