-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom-gcl.sh
executable file
·47 lines (41 loc) · 1.15 KB
/
custom-gcl.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
usage() {
echo "Usage: $0 [-b <bindir>] [-d] [-h] [-x]"
echo " -b <bindir> Specify the directory where custom-gcl will be moved (default: ./bin)"
echo " -d Enable debug logging"
echo " -h Display this help and exit"
echo " -x Set shell script debugging mode"
exit 1
}
parse_args() {
BINDIR="./bin"
while getopts ":b:dhx" arg; do
case "$arg" in
b) BINDIR="$OPTARG" ;;
d) set -x ;;
h) usage ;;
x) set -x ;;
*) usage ;;
esac
done
shift $((OPTIND - 1))
TAG=$1
}
parse_args "$@"
if ! command -v golangci-lint >/dev/null 2>&1; then
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.61.0;
fi
cat <<EOF > .custom-gcl.yml
version: v1.61.0
plugins:
- module: 'github.com/wallester/internal-linter-image'
import: 'github.com/wallester/internal-linter-image/analyzer'
version: v1.0.3
EOF
if golangci-lint custom -v; then
mv custom-gcl "$BINDIR" && echo "Operation completed successfully."
rm .custom-gcl.yml
else
echo "golangci-lint encountered an error."
rm .custom-gcl.yml
fi