mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-15 02:43:09 -06:00
Switch to golangci-lint
This commit is contained in:
parent
fccbe8b841
commit
645000385b
|
|
@ -2,19 +2,6 @@ steps:
|
|||
- command:
|
||||
- "go build ./cmd/..."
|
||||
label: ":hammer_and_wrench: Build / :go: 1.11"
|
||||
env:
|
||||
GOGC: "400"
|
||||
DENDRITE_LINT_DISABLE_GC: "1"
|
||||
plugins:
|
||||
- docker#v3.0.1:
|
||||
image: "golang:1.11"
|
||||
|
||||
- command:
|
||||
- "go test ./..."
|
||||
label: ":female-scientist: Unit tests / :go: 1.11"
|
||||
env:
|
||||
GOGC: "400"
|
||||
DENDRITE_LINT_DISABLE_GC: "1"
|
||||
plugins:
|
||||
- docker#v3.0.1:
|
||||
image: "golang:1.11"
|
||||
|
|
@ -22,19 +9,20 @@ steps:
|
|||
- command:
|
||||
- "go build ./cmd/..."
|
||||
label: ":hammer_and_wrench: Build / :go: 1.12"
|
||||
env:
|
||||
GOGC: "400"
|
||||
DENDRITE_LINT_DISABLE_GC: "1"
|
||||
plugins:
|
||||
- docker#v3.0.1:
|
||||
image: "golang:1.12"
|
||||
|
||||
- command:
|
||||
- "go test ./..."
|
||||
label: ":female-scientist: Unit tests / :go: 1.11"
|
||||
plugins:
|
||||
- docker#v3.0.1:
|
||||
image: "golang:1.11"
|
||||
|
||||
- command:
|
||||
- "go test ./..."
|
||||
label: ":female-scientist: Unit tests / :go: 1.12"
|
||||
env:
|
||||
GOGC: "400"
|
||||
DENDRITE_LINT_DISABLE_GC: "1"
|
||||
plugins:
|
||||
- docker#v3.0.1:
|
||||
image: "golang:1.12"
|
||||
|
|
@ -43,9 +31,7 @@ steps:
|
|||
- "./scripts/find-lint.sh"
|
||||
label: ":lower_left_crayon: Lint / :go: 1.12"
|
||||
env:
|
||||
GOGC: "400"
|
||||
DENDRITE_LINT_DISABLE_GC: "1"
|
||||
GO111MODULE: "off"
|
||||
GOGC: "100" # https://github.com/golangci/golangci-lint#memory-usage-of-golangci-lint
|
||||
plugins:
|
||||
- docker#v3.0.1:
|
||||
image: "golang:1.12"
|
||||
|
|
|
|||
|
|
@ -6,41 +6,27 @@
|
|||
# configured using two environment variables:
|
||||
#
|
||||
# - `DENDRITE_LINT_CONCURRENCY` - number of concurrent linters to run,
|
||||
# gometalinter defaults this to 8
|
||||
# - `DENDRITE_LINT_DISABLE_GC` - if set then the the go gc will be disabled
|
||||
# when running the linters, speeding them up but using much more memory.
|
||||
# golangci-lint defaults this to NumCPU
|
||||
|
||||
|
||||
set -eux
|
||||
|
||||
cd `dirname $0`/..
|
||||
|
||||
# gometalinter doesn't seem to work without this.
|
||||
# We should move from gometalinter asap as per https://github.com/matrix-org/dendrite/issues/697 so this is a temporary
|
||||
# fix.
|
||||
export GO111MODULE=off
|
||||
|
||||
args=""
|
||||
if [ ${1:-""} = "fast" ]
|
||||
then args="--config=linter-fast.json"
|
||||
else args="--config=linter.json"
|
||||
then args="--fast"
|
||||
fi
|
||||
|
||||
if [ -n "${DENDRITE_LINT_CONCURRENCY:-}" ]
|
||||
then args="$args --concurrency=$DENDRITE_LINT_CONCURRENCY"
|
||||
fi
|
||||
|
||||
if [ -z "${DENDRITE_LINT_DISABLE_GC:-}" ]
|
||||
then args="$args --enable-gc"
|
||||
fi
|
||||
|
||||
echo "Installing lint search engine..."
|
||||
go get github.com/alecthomas/gometalinter/
|
||||
|
||||
gometalinter --config=linter.json ./... --install
|
||||
echo "Installing golangci-lint..."
|
||||
go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
|
||||
|
||||
echo "Looking for lint..."
|
||||
gometalinter ./... $args
|
||||
golangci-lint run $args
|
||||
|
||||
echo "Double checking spelling..."
|
||||
misspell -error src *.md
|
||||
echo "Checking spelling..."
|
||||
golangci-lint -E "misspell" ./*.md
|
||||
|
|
|
|||
Loading…
Reference in a new issue