File: gofmt.sh

package info (click to toggle)
golang-github-nbrownus-go-metrics-prometheus 0.0~git20210712.974a626-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 148 kB
  • sloc: sh: 11; makefile: 9
file content (14 lines) | stat: -rwxr-xr-x 298 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh

if [ -z "$1" ]; then
    rm -f ./gofmterr
    find . -iname '*.go' ! -name '*.pb.go' -exec "$0" {} \;
    [ -f ./gofmterr ] && exit 1
    exit 0
fi

OUT="$(./goimports -d "$1" | awk '{printf "%s%%0A",$0}')"
if [ -n "$OUT" ]; then
    echo "::error file=$1::$OUT"
    touch ./gofmterr
fi