From 3ef957206c97631f6b025527c4fd36cec70407e1 Mon Sep 17 00:00:00 2001 From: Sai Kumar Date: Wed, 27 Oct 2021 11:50:32 +0530 Subject: [PATCH] docs: add golang install instructions --- testnet/multinode_testnet.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/testnet/multinode_testnet.sh b/testnet/multinode_testnet.sh index 73e9046e..e9f08af4 100644 --- a/testnet/multinode_testnet.sh +++ b/testnet/multinode_testnet.sh @@ -7,6 +7,35 @@ echo "Installing the require tools " sudo apt-get install git curl build-essential make nohup jq -y echo "Done Installing the tools" +command_exists() { + type "$1" &>/dev/null +} + +if command_exists go; then + echo "Golang is already installed" +else + echo "Installing golang dependencies" + wget https://golang.org/dl/go1.17.2.linux-amd64.tar.gz + rm -rf /usr/local/go && tar -C /usr/local -xzf go1.17.2.linux-amd64.tar.gz + + echo "Updating the profile" + export GOPATH=$HOME/go + export GOROOT=/usr/local/go + export GOBIN=$GOPATH/bin + export PATH=$PATH:/usr/local/go/bin:$GOBIN + + echo "" >>~/.profile + echo 'export GOPATH=$HOME/go' >>~/.profile + echo 'export GOROOT=/usr/local/go' >>~/.profile + echo 'export GOBIN=$GOPATH/bin' >>~/.profile + echo 'export PATH=$PATH:/usr/local/go/bin:$GOBIN' >>~/.profile + + source ~/.profile + mkdir -p "$GOBIN" + mkdir -p $GOPATH/src/github.com + go version +fi + # chain env variables export DAEMON_HOME=~/.testethermint export CHAINID=ethermint_9000-1