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.

66 lines
1.9 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/golang/dep/cmd/dep
  8. # github.com/gogo/protobuf/protoc-gen-gogo
  9. # github.com/square/certstrap
  10. # github.com/mitchellh/gox
  11. # github.com/golangci/golangci-lint
  12. # github.com/petermattis/goid
  13. # github.com/sasha-s/go-deadlock
  14. # goimports
  15. ## check if GOPATH is set
  16. if [ -z ${GOPATH+x} ]; then
  17. echo "please set GOPATH (https://github.com/golang/go/wiki/SettingGOPATH)"
  18. exit 1
  19. fi
  20. mkdir -p "$GOPATH/src/github.com"
  21. cd "$GOPATH/src/github.com" || exit 1
  22. installFromGithub() {
  23. repo=$1
  24. commit=$2
  25. # optional
  26. subdir=$3
  27. echo "--> Installing $repo ($commit)..."
  28. if [ ! -d "$repo" ]; then
  29. mkdir -p "$repo"
  30. git clone "https://github.com/$repo.git" "$repo"
  31. fi
  32. if [ ! -z ${subdir+x} ] && [ ! -d "$repo/$subdir" ]; then
  33. echo "ERROR: no such directory $repo/$subdir"
  34. exit 1
  35. fi
  36. pushd "$repo" && \
  37. git fetch origin && \
  38. git checkout -q "$commit" && \
  39. if [ ! -z ${subdir+x} ]; then cd "$subdir" || exit 1; fi && \
  40. go install && \
  41. if [ ! -z ${subdir+x} ]; then cd - || exit 1; fi && \
  42. popd || exit 1
  43. echo "--> Done"
  44. echo ""
  45. }
  46. ######################## DEVELOPER TOOLS #####################################
  47. installFromGithub gogo/protobuf 61dbc136cf5d2f08d68a011382652244990a53a9 protoc-gen-gogo
  48. installFromGithub square/certstrap e27060a3643e814151e65b9807b6b06d169580a7
  49. # used to build tm-monitor & tm-bench binaries
  50. installFromGithub mitchellh/gox 51ed453898ca5579fea9ad1f08dff6b121d9f2e8
  51. ## golangci-lint v1.13.2
  52. installFromGithub golangci/golangci-lint 7b2421d55194c9dc385eff7720a037aa9244ca3c cmd/golangci-lint
  53. ## make test_with_deadlock
  54. ## XXX: https://github.com/tendermint/tendermint/issues/3242
  55. installFromGithub petermattis/goid b0b1615b78e5ee59739545bb38426383b2cda4c9
  56. installFromGithub sasha-s/go-deadlock d68e2bc52ae3291765881b9056f2c1527f245f1e
  57. go get golang.org/x/tools/cmd/goimports