Skip to content

Instantly share code, notes, and snippets.

@n-able-consulting
Last active April 25, 2019 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n-able-consulting/e47e3b7055dc9f6cc2daf1eb7298275b to your computer and use it in GitHub Desktop.
Save n-able-consulting/e47e3b7055dc9f6cc2daf1eb7298275b to your computer and use it in GitHub Desktop.
ubuntu 18.04 go install script
#!/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