github.com/evdatsion/aphelion-dpos-bft@v0.32.1/scripts/get_tools.sh (about)

     1  #!/usr/bin/env bash
     2  set -e
     3  
     4  # This file downloads all of the binary dependencies we have, and checks out a
     5  # specific git hash.
     6  #
     7  # repos it installs:
     8  #   github.com/golang/dep/cmd/dep
     9  #   github.com/gogo/protobuf/protoc-gen-gogo
    10  #   github.com/square/certstrap
    11  #   github.com/mitchellh/gox
    12  #   github.com/golangci/golangci-lint
    13  #   github.com/petermattis/goid
    14  #   github.com/sasha-s/go-deadlock
    15  #   goimports
    16  
    17  ## check if GOPATH is set
    18  if [ -z ${GOPATH+x} ]; then
    19  	echo "please set GOPATH (https://github.com/golang/go/wiki/SettingGOPATH)"
    20  	exit 1
    21  fi
    22  
    23  mkdir -p "$GOPATH/src/github.com"
    24  cd "$GOPATH/src/github.com" || exit 1
    25  
    26  installFromGithub() {
    27  	repo=$1
    28  	commit=$2
    29  	# optional
    30  	subdir=$3
    31  	echo "--> Installing $repo ($commit)..."
    32  	if [ ! -d "$repo" ]; then
    33  		mkdir -p "$repo"
    34  		git clone "https://github.com/$repo.git" "$repo"
    35  	fi
    36  	if [ ! -z ${subdir+x} ] && [ ! -d "$repo/$subdir" ]; then
    37  		echo "ERROR: no such directory $repo/$subdir"
    38  		exit 1
    39  	fi
    40  	pushd "$repo" && \
    41  		git fetch origin && \
    42  		git checkout -q "$commit" && \
    43  		if [ ! -z ${subdir+x} ]; then cd "$subdir" || exit 1; fi && \
    44  		go install && \
    45  		if [ ! -z ${subdir+x} ]; then cd - || exit 1; fi && \
    46  		popd || exit 1
    47  	echo "--> Done"
    48  	echo ""
    49  }
    50  
    51  ######################## DEVELOPER TOOLS #####################################
    52  installFromGithub gogo/protobuf 61dbc136cf5d2f08d68a011382652244990a53a9 protoc-gen-gogo
    53  
    54  installFromGithub square/certstrap e27060a3643e814151e65b9807b6b06d169580a7
    55  
    56  # used to build tm-monitor & tm-bench binaries
    57  installFromGithub mitchellh/gox 51ed453898ca5579fea9ad1f08dff6b121d9f2e8
    58  
    59  ## golangci-lint v1.13.2
    60  installFromGithub golangci/golangci-lint 7b2421d55194c9dc385eff7720a037aa9244ca3c cmd/golangci-lint
    61  
    62  ## make test_with_deadlock
    63  ## XXX: https://github.com/evdatsion/aphelion-dpos-bft/issues/3242
    64  installFromGithub petermattis/goid b0b1615b78e5ee59739545bb38426383b2cda4c9
    65  installFromGithub sasha-s/go-deadlock d68e2bc52ae3291765881b9056f2c1527f245f1e
    66  go get golang.org/x/tools/cmd/goimports