Skip to content

Commit

Permalink
change gopath and goroot around to make more sense
Browse files Browse the repository at this point in the history
  • Loading branch information
vastbinderj committed Jul 15, 2015
1 parent beadd9b commit 2a130f2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 27 deletions.
5 changes: 3 additions & 2 deletions dotfiles/.bashrc
Expand Up @@ -32,10 +32,11 @@ fi
set -o vi

# Golang
export GOPATH=$HOME/go
export GOROOT=$HOME/go
export GOPATH=$HOME/code/go

# Update the Path
export PATH=$GOPATH/bin:$HOME/bin:$HOME/.node/bin:$HOME/.rbenv/bin:/usr/local/bin:/usr/local/sbin:$PATH
export PATH=$GOPATH/bin:$GOROOT/bin:$HOME/bin:$HOME/.node/bin:$HOME/.rbenv/bin:/usr/local/bin:/usr/local/sbin:$PATH

# add z
. $HOME/code/z/z.sh
Expand Down
42 changes: 17 additions & 25 deletions dotfiles/setup-a-new-machine.sh
Expand Up @@ -5,6 +5,19 @@
WORKDIR=`pwd`
GOSYSTEMVERSION=`go version`

# create code dir if it doesn't exist
if [ ! -d "$HOME/code" ]; then
mkdir -p $HOME/code
fi
$CODEDIR="$HOME/code"

# create GOPATH dirs
if [ ! -d "$HOME/go" ]; then
mkdir -p $CODEDIR/go
mkdir -p $CODEDIR/go/{src,pkg,bin}
fi


if [[ "$OSTYPE" == "darwin"* ]]; then
# Found Mac OSX

Expand All @@ -29,17 +42,6 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
echo $BASH_VERSION # should be 4.x not the old 3.2.X
# Later, confirm iterm settings aren't conflicting.

# create GOPATH dirs
if [ ! -d "$HOME/go" ]; then
mkdir -p $HOME/go
mkdir -p $HOME/go/{src,pkg,bin}
fi

# create code dir
if [ ! -d "$HOME/code" ]; then
mkdir -p $HOME/code
fi

elif [[ "$OSTYPE" == "linux-gnu" ]]; then
# Found Linux

Expand Down Expand Up @@ -108,30 +110,20 @@ elif [[ "$OSTYPE" == "linux-gnu" ]]; then
-y --reinstall
fi

# create GOPATH dirs
if [ ! -d "$HOME/go" ]; then
mkdir -p $HOME/go
mkdir -p $HOME/go/{src,pkg,bin}
fi

# create code dir
if [ ! -d "$HOME/code" ]; then
mkdir -p $HOME/code
fi
fi

# go.googlesource.com/go
# install golang from the source repository
if [[ "$GOSYSTEMVERSION" == *"go1.4.2"* ]]; then
# clean up soure dir if exists already
if [ -d $HOME/code/go ]; then
rm -f $HOME/code/go
if [ -d $HOME/go ]; then
rm -f $HOME/go
fi
git clone https://go.googlesource.com/go $HOME/code/go
cd $HOME/code/go
cd $HOME/go
# checkout go 1.4.2
git checkout go1.4.2
cd $HOME/code/go/src
cd $HOME/go/src
# build from source
CMD="sudo ./all.bash"
eval $CMD
Expand Down

0 comments on commit 2a130f2

Please sign in to comment.