Skip to content

Instantly share code, notes, and snippets.

@MichaelDimmitt
Forked from vsouza/.bashrc
Last active June 25, 2018 22:02
Show Gist options
  • Save MichaelDimmitt/6b7d8801ec4d624fefc3e54a8a318c33 to your computer and use it in GitHub Desktop.
Save MichaelDimmitt/6b7d8801ec4d624fefc3e54a8a318c33 to your computer and use it in GitHub Desktop.
Golang setup in Mac OSX with HomeBrew. Set `GOPATH` and `GOROOT` variables in zshell, fish or bash.
# Set variables in .bashrc file
# don't forget to change your path correctly!
export GOPATH=$HOME/go
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
# Set variables in .zshrc file
# don't forget to set path correctly!
export GOPATH=$HOME/go
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
# Set variables in config.fish file
# don't forget to set path correctly!
# GOLANG configurations
set -x GOPATH $HOME/go
set -x GOROOT /usr/local/opt/go/libexec
set PATH $GOPATH/bin $GOROOT/bin $PATH
echo "Please enter your golang path (ex: $HOME/golang) :"
read gopath
echo "Please enter your github username (ex: vsouza) :"
read user
mkdir $gopath
mkdir -p $gopath/src/github.com/$user
export GOPATH=$gopath
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update
brew install go
brew install git
brew install mercurial
go get golang.org/x/tools/cmd/godoc
go get golang.org/x/tools/cmd/vet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment