File: check_fmt.sh

package info (click to toggle)
golang-mongodb-mongo-driver 1.8.4%2Bds1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-backports
  • size: 18,520 kB
  • sloc: perl: 533; ansic: 491; python: 432; makefile: 187; sh: 72
file content (23 lines) | stat: -rwxr-xr-x 826 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env bash

gofmt_out="$(gofmt -l -s "$@")"

if [[ $gofmt_out ]]; then
  echo "gofmt check failed for:";
  sed -e 's/^/ - /' <<< "$gofmt_out";
  exit 1;
fi

# Use the "github.com/walle/lll" tool to check that all lines in *_example_test.go files are
# wrapped at 80 characters to keep them readable when rendered on https://pkg.go.dev.
# Ignore long lines that are comments containing URI-like strings.
# E.g ignored lines:
#     // "mongodb://ldap-user:ldap-pwd@localhost:27017/?authMechanism=PLAIN"
#     // (https://docs.mongodb.com/manual/core/authentication-mechanisms-enterprise/#security-auth-ldap).
lll_out="$(find "$@" -type f -name "*_examples_test.go" | lll -w 4 -l 80 -e '^\s*\/\/.+:\/\/' --files)"

if [[ $lll_out ]]; then
  echo "lll check failed for:";
  sed -e 's/^/ - /' <<< "$lll_out";
  exit 1;
fi