Last active
April 25, 2019 16:15
-
-
Save n-able-consulting/e47e3b7055dc9f6cc2daf1eb7298275b to your computer and use it in GitHub Desktop.
ubuntu 18.04 go install script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#version:1.0 | |
#installing go 1.12.4 | |
cd ~ | |
curl -O https://dl.google.com/go/go1.12.4.linux-amd64.tar.gz | |
tar xvf go1.12.4.linux-amd64.tar.gz | |
rm go1.12.4.linux-amd64.tar.gz | |
sudo chown -R root:root ./go | |
sudo mv go /usr/local | |
echo "export GOPATH=$HOME/work" >> .profile | |
echo "export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin" >> .profile | |
source .profile | |
mkdir $HOME/work | |
#validate working | |
mkdir -p work/src/github.com/user/hello | |
nano ~/work/src/github.com/user/hello/hello.go | |
cat <<EOF >> ~/work/src/github.com/user/hello/hello.gopackage main | |
import "fmt" | |
func main() { | |
fmt.Printf("hello, world\n") | |
} | |
EOF | |
go install github.com/user/hello | |
hello |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment