2017-10-10 11:02:39 +01:00
|
|
|
#! /bin/bash
|
|
|
|
|
|
|
|
# Runs the linters against dendrite
|
|
|
|
|
|
|
|
# The linters can take a lot of resources and are slow, so they can be
|
2019-06-19 14:05:03 +01:00
|
|
|
# configured using the following environment variables:
|
2017-10-10 11:02:39 +01:00
|
|
|
#
|
|
|
|
# - `DENDRITE_LINT_CONCURRENCY` - number of concurrent linters to run,
|
2019-06-19 14:05:03 +01:00
|
|
|
# golangci-lint defaults this to NumCPU
|
|
|
|
# - `GOGC` - how often to perform garbage collection during golangci-lint runs.
|
|
|
|
# Essentially a ratio of memory/speed. See https://github.com/golangci/golangci-lint#memory-usage-of-golangci-lint
|
|
|
|
# for more info.
|
2017-10-10 11:02:39 +01:00
|
|
|
|
|
|
|
|
2017-12-12 10:25:38 +00:00
|
|
|
set -eux
|
|
|
|
|
|
|
|
cd `dirname $0`/..
|
2017-10-10 11:02:39 +01:00
|
|
|
|
|
|
|
args=""
|
|
|
|
if [ ${1:-""} = "fast" ]
|
2019-06-19 14:05:03 +01:00
|
|
|
then args="--fast"
|
2017-10-10 11:02:39 +01:00
|
|
|
fi
|
|
|
|
|
2019-06-19 14:05:03 +01:00
|
|
|
echo "Installing golangci-lint..."
|
|
|
|
go get github.com/golangci/golangci-lint/cmd/golangci-lint
|
2017-10-10 11:02:39 +01:00
|
|
|
|
|
|
|
echo "Looking for lint..."
|
2019-06-19 14:05:03 +01:00
|
|
|
golangci-lint run $args
|