From b96093fa56a9c085cb3123010be2430753c40cbc Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Thu, 7 Sep 2017 11:59:56 -0700 Subject: [PATCH] gometalinter: add per-platform configurable options I have run into two separate issues while doing 'make all' on armhf (a Scaleway C1 machine, same as used in CI). This commit fixes both. 1. There were a lot of "not enough memory" errors, and after that in a few runs gometalinter just stuck forever on FUTEX_WAIT with no children left. Looking into docs, I found the --enable-gc option which solved the issue. [Update: this has already been added] 2. Timeout of 2 minutes is not enough for the abovementioned platform. The longest running linter is goimports which takes almost 6 minutes to run. Set the timeout to the observable run time roughly doubled. In addition, ARM platforms does not have too much RAM (2GB), so running too many processes in parallel might be problematic. Limit it by using -j2 [v2: make the timeout arch-dependent, also tested on aarch64 (2m15s)] [v3: moved timeout setting to Dockerfiles] [v4: generalized to GOMETALINTER_OPTS, added -j2 for ARM platforms] [v5: rebase to master] Signed-off-by: Kir Kolyshkin --- Dockerfile | 3 +++ Dockerfile.aarch64 | 3 +++ Dockerfile.armhf | 3 +++ hack/validate/gometalinter | 7 ++++++- hack/validate/gometalinter.json | 1 - 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8971edf6b8..ba84584954 100644 --- a/Dockerfile +++ b/Dockerfile @@ -216,3 +216,6 @@ ENTRYPOINT ["hack/dind"] # Upload docker source COPY . /go/src/github.com/docker/docker + +# Options for hack/validate/gometalinter +ENV GOMETALINTER_OPTS="--deadline 2m" diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index c59335b53f..ee67dcb8c8 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -181,3 +181,6 @@ ENTRYPOINT ["hack/dind"] # Upload docker source COPY . /go/src/github.com/docker/docker + +# Options for hack/validate/gometalinter +ENV GOMETALINTER_OPTS="--deadline 4m -j2" diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 80005bc26d..ed42b2dae9 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -169,3 +169,6 @@ ENTRYPOINT ["hack/dind"] # Upload docker source COPY . /go/src/github.com/docker/docker + +# Options for hack/validate/gometalinter +ENV GOMETALINTER_OPTS="--deadline 10m -j2" diff --git a/hack/validate/gometalinter b/hack/validate/gometalinter index 9830659d69..ae411e864a 100755 --- a/hack/validate/gometalinter +++ b/hack/validate/gometalinter @@ -3,4 +3,9 @@ set -e -o pipefail SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -gometalinter --config $SCRIPTDIR/gometalinter.json ./... +# CI platforms differ, so per-platform GOMETALINTER_OPTS can be set +# from a platform-specific Dockerfile, otherwise let's just set +# (somewhat pessimistic) default of 10 minutes. +gometalinter \ + ${GOMETALINTER_OPTS:--deadine 10m} \ + --config $SCRIPTDIR/gometalinter.json ./... diff --git a/hack/validate/gometalinter.json b/hack/validate/gometalinter.json index c43ddec892..93328f82ad 100644 --- a/hack/validate/gometalinter.json +++ b/hack/validate/gometalinter.json @@ -1,6 +1,5 @@ { "Vendor": true, - "Deadline": "2m", "EnableGC": true, "Sort": ["linter", "severity", "path"], "Exclude": [