Created
January 19, 2017 05:09
-
-
Save codevulture/03e7b9f8aff29aa80defddbb65a2c18e to your computer and use it in GitHub Desktop.
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/sh | |
GITHUB_USER=codevulture | |
#Download Compatible version of Go | |
GO_VERSION=go1.7.4.linux-amd64.tar.gz | |
VM_USER=vagrant | |
wget https://storage.googleapis.com/golang/$GO_VERSION > /dev/null 2>&1 | |
sudo tar -C /usr/local -xzf $GO_VERSION | |
#Add to bash if needed | |
#set environment variables for Go | |
su "$VM_USER" -c "echo 'source /vagrant/go_rc' >> ~/.bashrc" | |
#Set go directory and go paths | |
su $VM_USER | |
mkdir $HOME/work | |
mkdir -p $GOPATH/src/github.com/$GITHUB_USER | |
mkdir $GOPATH/src/github.com/$GITHUB_USER/hello | |
cat > hello.go << EOF | |
package main | |
import "fmt" | |
func main() { | |
fmt.Printf("Hello, world.\n") | |
} | |
EOF | |
scp -r hello.go $GOPATH/src/github.com/$GITHUB_USER/hello/ | |
go install github.com/$GITHUB_USER/hello | |
$GOPATH/bin/hello |
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
export PATH=$PATH:/usr/local/go/bin | |
export GOPATH=$HOME/work | |
export PATH=$PATH:$GOPATH/bin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment