From a43e31fbf9eb86be46a11dcfc6cf85d3fdc4a6c8 Mon Sep 17 00:00:00 2001 From: Arve Knudsen Date: Mon, 23 Mar 2020 17:33:06 +0100 Subject: [PATCH] CircleCI: Reduce memory usage of golangci-lint (#22970) * CircleCI: Fix golangci-lint OOM by reducing concurrency and tweaking GC --- .circleci/config.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 867f2f0360c..ce569b8d49a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -714,12 +714,23 @@ jobs: environment: # we need CGO because of go-sqlite3 CGO_ENABLED: 1 + # Reduce golangci-lint memory usage (default is 100) + GOGC: 20 working_directory: /go/src/github.com/grafana/grafana steps: - checkout - run: name: Lint Go - command: "make lint-go" + command: | + # Build linters + make scripts/go/bin/golangci-lint scripts/go/bin/revive scripts/go/bin/gosec + go vet ./pkg/... + # Avoid golangci-lint concurrency since it tends to run out of memory + ./scripts/go/bin/golangci-lint run --config scripts/go/configs/.golangci.yml -j 1 ./pkg/... + ./scripts/go/bin/revive -formatter stylish -config ./scripts/go/configs/revive.toml ./pkg/... + ./scripts/go/bin/revive -formatter stylish ./pkg/services/alerting/... + ./scripts/go/bin/gosec -quiet -exclude=G104,G107,G108,G201,G202,G204,G301,G304,G401,G402,G501 \ + -conf=./scripts/go/configs/gosec.json ./pkg/... test-frontend: docker: