File: .check-gofmt.sh

package info (click to toggle)
golang-github-ergochat-readline 0.1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 336 kB
  • sloc: makefile: 17
file content (14 lines) | stat: -rwxr-xr-x 262 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/bash

# exclude vendor/
SOURCES="*.go internal/ example/"

if [ "$1" = "--fix" ]; then
	exec gofmt -s -w $SOURCES
fi

if [ -n "$(gofmt -s -l $SOURCES)" ]; then
	echo "Go code is not formatted correctly with \`gofmt -s\`:"
	gofmt -s -d $SOURCES
	exit 1
fi