Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Shushlin <v.shushlin@gmail.com>2019-10-22 09:48:22 +0300
committerVladimir Shushlin <v.shushlin@gmail.com>2019-10-22 13:24:40 +0300
commit181aa2c4619a15cefc1bd382a70a5d014f91a80a (patch)
tree62b81e3d7b38a299db6f9480536cede949a68289
parentd7f7542f856487e2692feec0a48f7a23851fb940 (diff)
Fix make verify ci job
For some reason long awk command makes it crash with a segmentation fault error. I tested this by replacing $(allfiles) in `"Please run ./bin/goimports -w -local $(IMPORT_PATH) -l $(allfiles)"` with strings of various length, and it fails on longer strings. I haven't yet figured out the source of the problem, so just copypasted the approach from workhorse - extracted a separate script which uses if in shell script and echo to print the suggestion.
-rw-r--r--Makefile.util.mk2
-rwxr-xr-x_support/validate-formatting.sh11
2 files changed, 12 insertions, 1 deletions
diff --git a/Makefile.util.mk b/Makefile.util.mk
index 8a36d805..80ca63b1 100644
--- a/Makefile.util.mk
+++ b/Makefile.util.mk
@@ -3,7 +3,7 @@
verify: list fmt vet lint complexity
fmt: bin/goimports .GOPATH/.ok
- $Q @./bin/goimports -local $(IMPORT_PATH) -l $(allfiles) | awk '{ print } END { if (NR>0) { print "Please run ./bin/goimports -w -local $(IMPORT_PATH) -l $(allfiles)"; exit 1 } }'
+ $Q @_support/validate-formatting.sh $(allfiles)
vet: .GOPATH/.ok
$Q go vet $(allpackages)
diff --git a/_support/validate-formatting.sh b/_support/validate-formatting.sh
new file mode 100755
index 00000000..38f54661
--- /dev/null
+++ b/_support/validate-formatting.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -eu
+
+IMPORT_RESULT=$(./bin/goimports -e -local "gitlab.com/gitlab-org/gitlab-pages" -l "$@")
+
+if [ -n "${IMPORT_RESULT}" ]; then
+ echo >&2 "Please run ./bin/goimports -w -local gitlab.com/gitlab-org/gitlab-pages -l $@"
+ echo "${IMPORT_RESULT}"
+ exit 1
+fi