mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-15 10:53:09 -06:00
Switch to golangci-lint
This commit is contained in:
parent
fccbe8b841
commit
645000385b
|
|
@ -2,19 +2,6 @@ steps:
|
||||||
- command:
|
- command:
|
||||||
- "go build ./cmd/..."
|
- "go build ./cmd/..."
|
||||||
label: ":hammer_and_wrench: Build / :go: 1.11"
|
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:
|
plugins:
|
||||||
- docker#v3.0.1:
|
- docker#v3.0.1:
|
||||||
image: "golang:1.11"
|
image: "golang:1.11"
|
||||||
|
|
@ -22,19 +9,20 @@ steps:
|
||||||
- command:
|
- command:
|
||||||
- "go build ./cmd/..."
|
- "go build ./cmd/..."
|
||||||
label: ":hammer_and_wrench: Build / :go: 1.12"
|
label: ":hammer_and_wrench: Build / :go: 1.12"
|
||||||
env:
|
|
||||||
GOGC: "400"
|
|
||||||
DENDRITE_LINT_DISABLE_GC: "1"
|
|
||||||
plugins:
|
plugins:
|
||||||
- docker#v3.0.1:
|
- docker#v3.0.1:
|
||||||
image: "golang:1.12"
|
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:
|
- command:
|
||||||
- "go test ./..."
|
- "go test ./..."
|
||||||
label: ":female-scientist: Unit tests / :go: 1.12"
|
label: ":female-scientist: Unit tests / :go: 1.12"
|
||||||
env:
|
|
||||||
GOGC: "400"
|
|
||||||
DENDRITE_LINT_DISABLE_GC: "1"
|
|
||||||
plugins:
|
plugins:
|
||||||
- docker#v3.0.1:
|
- docker#v3.0.1:
|
||||||
image: "golang:1.12"
|
image: "golang:1.12"
|
||||||
|
|
@ -43,9 +31,7 @@ steps:
|
||||||
- "./scripts/find-lint.sh"
|
- "./scripts/find-lint.sh"
|
||||||
label: ":lower_left_crayon: Lint / :go: 1.12"
|
label: ":lower_left_crayon: Lint / :go: 1.12"
|
||||||
env:
|
env:
|
||||||
GOGC: "400"
|
GOGC: "100" # https://github.com/golangci/golangci-lint#memory-usage-of-golangci-lint
|
||||||
DENDRITE_LINT_DISABLE_GC: "1"
|
|
||||||
GO111MODULE: "off"
|
|
||||||
plugins:
|
plugins:
|
||||||
- docker#v3.0.1:
|
- docker#v3.0.1:
|
||||||
image: "golang:1.12"
|
image: "golang:1.12"
|
||||||
|
|
|
||||||
|
|
@ -6,41 +6,27 @@
|
||||||
# configured using two environment variables:
|
# configured using two environment variables:
|
||||||
#
|
#
|
||||||
# - `DENDRITE_LINT_CONCURRENCY` - number of concurrent linters to run,
|
# - `DENDRITE_LINT_CONCURRENCY` - number of concurrent linters to run,
|
||||||
# gometalinter defaults this to 8
|
# golangci-lint defaults this to NumCPU
|
||||||
# - `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.
|
|
||||||
|
|
||||||
|
|
||||||
set -eux
|
set -eux
|
||||||
|
|
||||||
cd `dirname $0`/..
|
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=""
|
args=""
|
||||||
if [ ${1:-""} = "fast" ]
|
if [ ${1:-""} = "fast" ]
|
||||||
then args="--config=linter-fast.json"
|
then args="--fast"
|
||||||
else args="--config=linter.json"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${DENDRITE_LINT_CONCURRENCY:-}" ]
|
if [ -n "${DENDRITE_LINT_CONCURRENCY:-}" ]
|
||||||
then args="$args --concurrency=$DENDRITE_LINT_CONCURRENCY"
|
then args="$args --concurrency=$DENDRITE_LINT_CONCURRENCY"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${DENDRITE_LINT_DISABLE_GC:-}" ]
|
echo "Installing golangci-lint..."
|
||||||
then args="$args --enable-gc"
|
go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Installing lint search engine..."
|
|
||||||
go get github.com/alecthomas/gometalinter/
|
|
||||||
|
|
||||||
gometalinter --config=linter.json ./... --install
|
|
||||||
|
|
||||||
echo "Looking for lint..."
|
echo "Looking for lint..."
|
||||||
gometalinter ./... $args
|
golangci-lint run $args
|
||||||
|
|
||||||
echo "Double checking spelling..."
|
echo "Checking spelling..."
|
||||||
misspell -error src *.md
|
golangci-lint -E "misspell" ./*.md
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue