X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/49566fe4e40a18434320829c5cb6a6eff1b4ec78..12bd9e96f3b3e67290484e3829461e054110db27:/bin/check?ds=inline diff --git a/bin/check b/bin/check index 4bd9b5c..e8e6e97 100755 --- a/bin/check +++ b/bin/check @@ -7,12 +7,21 @@ files() { git ls-files --cached --others --exclude-standard -- "$@" } -unformatted=$(gofumpt -l .) +unformatted=$(files '*.go' | xargs gofumpt -l) if [ -n "$unformatted" ]; then printf 'gofumpt: unformatted files:\n%s\n' "$unformatted" >&2 exit 1 fi +# Comment lines stay within the width of bin/reflow, with tabs as 8 columns. +long=$(files '*.go' | while read -r file; do + expand -t8 "$file" | awk -v file="$file" 'length > 80 && /^[[:space:]]*\/\//{print file ":" FNR}' +done) +if [ -n "$long" ]; then + printf 'comment lines over 80 columns, run bin/reflow:\n%s\n' "$long" >&2 + exit 1 +fi + go vet ./... golangci-lint run go test -race -short ./...