vendor.sh 1.1 KB

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env bash
  2. # This file is just wrapper around vndr (github.com/LK4D4/vndr) tool.
  3. # For updating dependencies you should change `vendor.conf` file in root of the
  4. # project. Please refer to https://github.com/LK4D4/vndr/blob/master/README.md for
  5. # vndr usage.
  6. set -e
  7. if ! hash vndr; then
  8. echo "Please install vndr with \"go get github.com/LK4D4/vndr\" and put it in your \$GOPATH"
  9. exit 1
  10. fi
  11. if [ $# -eq 0 ] || [ "$1" = "archive/tar" ]; then
  12. echo "update vendored copy of archive/tar"
  13. : "${GO_VERSION:=$(awk -F '[ =]' '$1 == "ARG" && $2 == "GO_VERSION" { print $3; exit }' ./Dockerfile)}"
  14. rm -rf vendor/archive
  15. mkdir -p ./vendor/archive/tar
  16. echo "downloading: https://golang.org/dl/go${GO_VERSION%.0}.src.tar.gz"
  17. curl -fsSL "https://golang.org/dl/go${GO_VERSION%.0}.src.tar.gz" \
  18. | tar --extract --gzip --directory=vendor/archive/tar --strip-components=4 go/src/archive/tar
  19. patch --strip=4 --directory=vendor/archive/tar --input="$PWD/patches/0001-archive-tar-do-not-populate-user-group-names.patch"
  20. fi
  21. if [ $# -eq 0 ] || [ "$1" != "archive/tar" ]; then
  22. vndr -whitelist='^archive[/\\]tar' "$@"
  23. fi