Browse code

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 <kolyshkin@gmail.com>

Kir Kolyshkin authored on 2017/09/08 03:59:56
Showing 5 changed files
... ...
@@ -216,3 +216,6 @@ ENTRYPOINT ["hack/dind"]
216 216
 
217 217
 # Upload docker source
218 218
 COPY . /go/src/github.com/docker/docker
219
+
220
+# Options for hack/validate/gometalinter
221
+ENV GOMETALINTER_OPTS="--deadline 2m"
... ...
@@ -181,3 +181,6 @@ ENTRYPOINT ["hack/dind"]
181 181
 
182 182
 # Upload docker source
183 183
 COPY . /go/src/github.com/docker/docker
184
+
185
+# Options for hack/validate/gometalinter
186
+ENV GOMETALINTER_OPTS="--deadline 4m -j2"
... ...
@@ -169,3 +169,6 @@ ENTRYPOINT ["hack/dind"]
169 169
 
170 170
 # Upload docker source
171 171
 COPY . /go/src/github.com/docker/docker
172
+
173
+# Options for hack/validate/gometalinter
174
+ENV GOMETALINTER_OPTS="--deadline 10m -j2"
... ...
@@ -3,4 +3,9 @@ set -e -o pipefail
3 3
 
4 4
 SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
5 5
 
6
-gometalinter --config $SCRIPTDIR/gometalinter.json ./...
6
+# CI platforms differ, so per-platform GOMETALINTER_OPTS can be set
7
+# from a platform-specific Dockerfile, otherwise let's just set
8
+# (somewhat pessimistic) default of 10 minutes.
9
+gometalinter \
10
+	${GOMETALINTER_OPTS:--deadine 10m} \
11
+	--config $SCRIPTDIR/gometalinter.json ./...
... ...
@@ -1,6 +1,5 @@
1 1
 {
2 2
   "Vendor": true,
3
-  "Deadline": "2m",
4 3
   "EnableGC": true,
5 4
   "Sort": ["linter", "severity", "path"],
6 5
   "Exclude": [