vendor.sh 709 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/env bash
  2. #
  3. # This file is just a wrapper around the 'go mod vendor' tool.
  4. # For updating dependencies you should change `vendor.mod` file in root of the
  5. # project.
  6. set -e
  7. SCRIPTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  8. tidy() (
  9. set -x
  10. "${SCRIPTDIR}"/with-go-mod.sh go mod tidy -modfile vendor.mod -compat 1.18
  11. )
  12. vendor() (
  13. set -x
  14. "${SCRIPTDIR}"/with-go-mod.sh go mod vendor -modfile vendor.mod
  15. )
  16. help() {
  17. printf "%s:\n" "$(basename "$0")"
  18. echo " - tidy: run go mod tidy"
  19. echo " - vendor: run go mod vendor"
  20. echo " - all: run tidy && vendor"
  21. echo " - help: show this help"
  22. }
  23. case "$1" in
  24. tidy) tidy ;;
  25. vendor) vendor ;;
  26. ""|all) tidy && vendor ;;
  27. *) help ;;
  28. esac