From bb5736b0a3826c598d2a59b2f252f8ae054f57e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Tue, 23 Jul 2019 14:56:24 +0200 Subject: [PATCH 1/2] Limit the number of golangci-lint jobs to one If you want the old behaviour back, use: e.g. make lint GOLINT_JOBS=`nproc` Running multiple linters takes a lot of RAM. And it only saves us like 15 seconds anyway ? --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 124805b0b7..c13733cc3b 100755 --- a/Makefile +++ b/Makefile @@ -47,6 +47,8 @@ KERNEL_VERSION ?= 4.16.14 GO_VERSION ?= $(shell go version | cut -d' ' -f3 | sed -e 's/go//') GOLINT_VERSION ?= v1.17.1 +# Limit number of default jobs, to avoid the CI builds running out of memory +GOLINT_JOBS ?= 1 export GO111MODULE := on GOOS ?= $(shell go env GOOS) @@ -276,6 +278,7 @@ out/linters/golangci-lint: .PHONY: lint lint: pkg/minikube/assets/assets.go pkg/minikube/translate/translations.go out/linters/golangci-lint ./out/linters/golangci-lint run \ + --concurrency ${GOLINT_JOBS} \ --deadline 4m \ --build-tags "${MINIKUBE_INTEGRATION_BUILD_TAGS}" \ --enable goimports,gocritic,golint,gocyclo,interfacer,misspell,nakedret,stylecheck,unconvert,unparam \ From 7da86459c5a6b021f7addeec784245ae3c8d878f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Tue, 23 Jul 2019 15:20:04 +0200 Subject: [PATCH 2/2] Increase garbage collection for golangci-lint This will again increase the total test time. But hopefully make it use less memory as well. --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c13733cc3b..3499b752b4 100755 --- a/Makefile +++ b/Makefile @@ -49,6 +49,9 @@ GO_VERSION ?= $(shell go version | cut -d' ' -f3 | sed -e 's/go//') GOLINT_VERSION ?= v1.17.1 # Limit number of default jobs, to avoid the CI builds running out of memory GOLINT_JOBS ?= 1 +# see https://github.com/golangci/golangci-lint#memory-usage-of-golangci-lint +GOLINT_GOGC ?= 10 + export GO111MODULE := on GOOS ?= $(shell go env GOOS) @@ -277,7 +280,7 @@ out/linters/golangci-lint: .PHONY: lint lint: pkg/minikube/assets/assets.go pkg/minikube/translate/translations.go out/linters/golangci-lint - ./out/linters/golangci-lint run \ + GOGC=${GOLINT_GOGC} ./out/linters/golangci-lint run \ --concurrency ${GOLINT_JOBS} \ --deadline 4m \ --build-tags "${MINIKUBE_INTEGRATION_BUILD_TAGS}" \