File: ci-lint-fmt.sh

package info (click to toggle)
golang-github-henvic-httpretty 0.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 352 kB
  • sloc: sh: 61; makefile: 3
file content (13 lines) | stat: -rw-r--r-- 504 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
# Adapted from @aminueza's go-github-action/fmt/fmt.sh
# Reference: https://github.com/aminueza/go-github-action/blob/master/fmt/fmt.sh
# Execute fmt tool, resolve and emit each unformatted file
UNFORMATTED_FILES=$(go fmt $(go list ./... | grep -v /vendor/))

if [ -n "$UNFORMATTED_FILES" ]; then
	echo '::error::The following files are not properly formatted:'
	echo "$UNFORMATTED_FILES" | while read -r LINE; do
		FILE=$(realpath --relative-base="." "$LINE")
		echo "::error::  $FILE"
	done
	exit 1
fi