Signed-off-by: Bjorn Neergaard <bneergaard@mirantis.com>
| ... | ... |
@@ -1,14 +1,37 @@ |
| 1 | 1 |
#!/usr/bin/env bash |
| 2 |
- |
|
| 3 |
-# This file is just wrapper around 'go mod vendor' tool. |
|
| 2 |
+# |
|
| 3 |
+# This file is just a wrapper around the 'go mod vendor' tool. |
|
| 4 | 4 |
# For updating dependencies you should change `vendor.mod` file in root of the |
| 5 | 5 |
# project. |
| 6 | 6 |
|
| 7 | 7 |
set -e |
| 8 |
-set -x |
|
| 9 | 8 |
|
| 10 | 9 |
SCRIPTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
| 11 | 10 |
"${SCRIPTDIR}"/go-mod-prepare.sh
|
| 12 | 11 |
|
| 13 |
-GO111MODULE=auto go mod tidy -modfile 'vendor.mod' -compat 1.18 |
|
| 14 |
-GO111MODULE=auto go mod vendor -modfile vendor.mod |
|
| 12 |
+export GO111MODULE=on |
|
| 13 |
+ |
|
| 14 |
+tidy() ( |
|
| 15 |
+ set -x |
|
| 16 |
+ go mod tidy -modfile vendor.mod -compat 1.18 |
|
| 17 |
+) |
|
| 18 |
+ |
|
| 19 |
+vendor() ( |
|
| 20 |
+ set -x |
|
| 21 |
+ go mod vendor -modfile vendor.mod |
|
| 22 |
+) |
|
| 23 |
+ |
|
| 24 |
+help() {
|
|
| 25 |
+ printf "%s:\n" "$(basename "$0")" |
|
| 26 |
+ echo " - tidy: run go mod tidy" |
|
| 27 |
+ echo " - vendor: run go mod vendor" |
|
| 28 |
+ echo " - all: run tidy && vendor" |
|
| 29 |
+ echo " - help: show this help" |
|
| 30 |
+} |
|
| 31 |
+ |
|
| 32 |
+case "$1" in |
|
| 33 |
+ tidy) tidy ;; |
|
| 34 |
+ vendor) vendor ;; |
|
| 35 |
+ ""|all) tidy && vendor ;; |
|
| 36 |
+ *) help ;; |
|
| 37 |
+esac |