File tree Expand file tree Collapse file tree 2 files changed +34
-26
lines changed
Expand file tree Collapse file tree 2 files changed +34
-26
lines changed Original file line number Diff line number Diff line change 1- #! /bin/sh
1+ #! /bin/bash
22
33set -eu
44
@@ -11,8 +11,38 @@ echo "${SCRIPT_NAME} is running... "
1111
1212cd " ${TOOLS_DIR} " || exit 1
1313
14- go generate -x -tags=tools
14+ function check_status() {
15+ # first param is error message to print in case of error
16+ if [ $? -ne 0 ]; then
17+ if [ -n " $1 " ]; then
18+ echo " $1 "
19+ fi
1520
16- cd - || exit 1
21+ # Exit 255 to pass signal to xargs to abort process with code 1, in other cases xargs will complete with 0.
22+ exit 255
23+ fi
24+ }
1725
18- echo " ${SCRIPT_NAME} done."
26+ function install_dep() {
27+ dep=$1
28+
29+ echo " [INFO]: Going to build ${dep} "
30+
31+ go install -mod=vendor " ${dep} "
32+
33+ check_status " [FAIL]: build [${dep} ] failed!"
34+
35+ echo " [SUCCESS]: build [${dep} ] finished."
36+ }
37+
38+ export -f install_dep
39+ export -f check_status
40+
41+ function install_deps() {
42+ tools_module=" $( go list -m) "
43+
44+ go list -f ' {{ join .Imports "\n" }}' -tags=" tools" " ${tools_module} " |
45+ xargs -n 1 -P 0 -I {} bash -c ' install_dep "$@"' _ {}
46+ }
47+
48+ install_deps
Original file line number Diff line number Diff line change 33
44package tools
55
6- //go:generate go clean
7-
8- //go:generate go install -mod=vendor github.com/axw/gocov/gocov
9-
10- //go:generate go install -mod=vendor github.com/golangci/golangci-lint/cmd/golangci-lint
11-
12- //go:generate go install -mod=vendor github.com/matm/gocov-html
13-
14- //go:generate go install -mod=vendor github.com/vasi-stripe/gogroup/cmd/gogroup
15-
16- //go:generate go install -mod=vendor golang.org/x/tools/cmd/cover
17-
18- //go:generate go install -mod=vendor github.com/mattn/goveralls
19-
20- //go:generate go install -mod=vendor github.com/obalunenko/coverbadger/cmd/coverbadger
21-
22- //go:generate go install -mod=vendor github.com/goreleaser/goreleaser
23-
24- //go:generate go install -mod=vendor gotest.tools/gotestsum
25-
26- //go:generate go install -mod=vendor golang.org/x/tools/cmd/stringer
27-
286import (
297 _ "github.com/axw/gocov/gocov"
308 _ "github.com/golangci/golangci-lint/cmd/golangci-lint"
You can’t perform that action at this time.
0 commit comments