-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Expand file tree
/
Copy pathlint.sh
More file actions
executable file
·21 lines (16 loc) · 822 Bytes
/
lint.sh
File metadata and controls
executable file
·21 lines (16 loc) · 822 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env bash
set -euo pipefail
GOLANGCI_LINT_VERSION="v2.11.4"
# TODO: Re-enable errcheck and staticcheck once pre-existing issues are resolved.
LINT_ARGS="--disable errcheck,staticcheck --enable bodyclose,copyloopvar,misspell --timeout 10m"
GOBIN="$(go env GOPATH)/bin"
GOLANGCI_LINT="${GOBIN}/golangci-lint"
# Install the required version if missing or mismatched.
if [[ -x "${GOLANGCI_LINT}" ]] && "${GOLANGCI_LINT}" version 2>&1 | grep -q "${GOLANGCI_LINT_VERSION#v}"; then
echo "golangci-lint ${GOLANGCI_LINT_VERSION} found"
else
echo "Installing golangci-lint ${GOLANGCI_LINT_VERSION}..."
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b "${GOBIN}" "${GOLANGCI_LINT_VERSION}"
fi
# shellcheck disable=SC2086
"${GOLANGCI_LINT}" run ${LINT_ARGS}