You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.7 KiB

  1. #!/usr/bin/env bash
  2. set -e
  3. # This file downloads all of the binary dependencies we have, and checks out a
  4. # specific git hash.
  5. #
  6. # repos it installs:
  7. # github.com/mitchellh/gox
  8. # github.com/golang/dep/cmd/dep
  9. # gopkg.in/alecthomas/gometalinter.v2
  10. # github.com/gogo/protobuf/protoc-gen-gogo
  11. # github.com/square/certstrap
  12. ## check if GOPATH is set
  13. if [ -z ${GOPATH+x} ]; then
  14. echo "please set GOPATH (https://github.com/golang/go/wiki/SettingGOPATH)"
  15. exit 1
  16. fi
  17. mkdir -p "$GOPATH/src/github.com"
  18. cd "$GOPATH/src/github.com" || exit 1
  19. installFromGithub() {
  20. repo=$1
  21. commit=$2
  22. # optional
  23. subdir=$3
  24. echo "--> Installing $repo ($commit)..."
  25. if [ ! -d "$repo" ]; then
  26. mkdir -p "$repo"
  27. git clone "https://github.com/$repo.git" "$repo"
  28. fi
  29. if [ ! -z ${subdir+x} ] && [ ! -d "$repo/$subdir" ]; then
  30. echo "ERROR: no such directory $repo/$subdir"
  31. exit 1
  32. fi
  33. pushd "$repo" && \
  34. git fetch origin && \
  35. git checkout -q "$commit" && \
  36. if [ ! -z ${subdir+x} ]; then cd "$subdir" || exit 1; fi && \
  37. go install && \
  38. if [ ! -z ${subdir+x} ]; then cd - || exit 1; fi && \
  39. popd || exit 1
  40. echo "--> Done"
  41. echo ""
  42. }
  43. installFromGithub mitchellh/gox 51ed453898ca5579fea9ad1f08dff6b121d9f2e8
  44. installFromGithub golang/dep 22125cfaa6ddc71e145b1535d4b7ee9744fefff2 cmd/dep
  45. ## gometalinter v3.0.0
  46. installFromGithub alecthomas/gometalinter df395bfa67c5d0630d936c0044cf07ff05086655
  47. installFromGithub gogo/protobuf 61dbc136cf5d2f08d68a011382652244990a53a9 protoc-gen-gogo
  48. installFromGithub square/certstrap e27060a3643e814151e65b9807b6b06d169580a7
  49. ## make test_with_deadlock
  50. installFromGithub petermattis/goid b0b1615b78e5ee59739545bb38426383b2cda4c9
  51. installFromGithub sasha-s/go-deadlock d68e2bc52ae3291765881b9056f2c1527f245f1e
  52. go get golang.org/x/tools/cmd/goimports