Skip to content
Browse files

Add goenv

Install with golang
Add goenv to zsh and bash
  • Loading branch information...
1 parent ca5f318 commit 53560baf6140ae5479e3c05f123f792da9667690 @ascarter committed Jun 27, 2014
Showing with 26 additions and 10 deletions.
  1. +15 −8 rakelib/golang.rake
  2. +7 −0 src/bashrc
  3. +4 −2 src/zshenv
View
23 rakelib/golang.rake
@@ -4,7 +4,6 @@ namespace "golang" do
desc "Install Go language"
task :install do
go_root = File.expand_path('/usr/local/go')
- go_user_dir = File.expand_path('~/.go')
go_prog = File.join(go_root, 'bin', 'go')
unless File.exist?(go_root)
@@ -18,19 +17,27 @@ namespace "golang" do
end
end
end
-
- # Configure default GOPATH repository
- unless File.exist?(go_user_dir)
- mkdir(go_user_dir)
- end
-
+
puts %x{#{go_prog} version}
- # TODO: Install some standard go packages?
+ # Install/update goenv
+ goenv_root = Pathname.new(File.expand_path(File.join(ENV['HOME'], '.goenv')))
+ unless File.exist?(goenv_root.to_s)
+ puts "Installing goenv..."
+ git_clone('ascarter', 'goenv', goenv_root)
+ else
+ puts "Updating goenv..."
+ git_pull(goenv_root)
+ end
end
desc "Uninstall Go language"
task :uninstall do
+ puts "Uninstalling goenv..."
+ goenv_root = Pathname.new(File.expand_path(File.join(ENV['HOME'], '.goenv')))
+ file_remove(goenv_root)
+
+ puts "Uninstalling go language..."
go_root = File.expand_path('/usr/local/go')
if File.exist?(go_root)
if RUBY_PLATFORM =~ /darwin/
View
7 src/bashrc
@@ -61,6 +61,13 @@ export LESS="--status-column --long-prompt --no-init --quit-if-one-screen --quit
# Homebrew
export HOMEBREW_NO_EMOJI=1
+# Go
+export GOROOT=/usr/local/go
+export PATH=$PATH:$GOROOT/bin #:${GOPATH//://bin:}/bin
+if [ -d ~/.goenv ]; then
+ source ~/.goenv/goenv
+fi
+
# Ruby (rbenv)
if [ -d ~/.rbenv ]; then
export PATH=~/.rbenv/bin:${PATH}
View
6 src/zshenv
@@ -54,8 +54,10 @@ fi
# Go
export GOROOT=/usr/local/go
-export GOPATH=~/.go
-export PATH=$PATH:$GOROOT/bin:${GOPATH//://bin:}/bin
+export PATH=$PATH:$GOROOT/bin #:${GOPATH//://bin:}/bin
+if [ -d ~/.goenv ]; then
+ source ~/.goenv/goenv
+fi
# Ruby (rbenv)
if [ -d ~/.rbenv/bin ]; then

0 comments on commit 53560ba

Please sign in to comment.
Something went wrong with that request. Please try again.