Commits

Yoshifumi YAMAGUCHI committed e2f0b35 Merge

Merged in MiCHiLU/goenv (pull request #6)

More beginner friendly and some fixes

Comments (0)

Files changed (4)

+*.sw?
 *~
 .DS_Store
 * ``GOENVTARGET``: goenv install target. goenv and goenvwrapper.sh are installed here.
 * ``GOENVHOME``: All workspaces created with ``goof`` command are here.
 
+ex) ``~/.zshrc``::
+
+  export GOENVGOROOT=$HOME/.goenvs
+  export GOENVTARGET=$HOME/bin
+  export GOENVHOME=$HOME/workspace
+
 If you're fine with installing Go from the source code and goenv at the same time, use initial-install.sh::
 
    $ curl -L https://bitbucket.org/ymotongpoo/goenv/raw/master/shellscripts/initial-install.sh | zsh
 
+If you feel anxious to the warning message as shown below::
+
+   warning: code.google.com certificate with fingerprint c7:9d:1d:b2:a0:5a:3d:98:63:2c:1c:44:f2:13:c1:10:96:76:ba:fb not verified (check hostfingerprints or web.cacerts config setting)
+
+Then you can adding ``hostfingerprints`` section to ``~/.hgrc`` configuration file for Mercurial::
+
+  [hostfingerprints]
+  code.google.com = c7:9d:1d:b2:a0:5a:3d:98:63:2c:1c:44:f2:13:c1:10:96:76:ba:fb
+
+When the installation that ``release`` version of golang is finished, you can set the ``GOROOT`` variable and adding ``$GOROOT/bin`` to ``$PATH``.
+ex) ``~/.zshrc``::
+
+  export GOROOT=$GOENVGOROOT/release
+  export PATH=$GOROOT/bin:$PATH
+
 3. Usage
 ========
 
 All installed Go binaries are shown with ``goinstall`` subcommand without arguments::
 
    % goof goinstall
-     /opt/goenv/go
+     /opt/goenv/go (repository)
      /opt/goenv/go1.0.2
    * /opt/goenv/go1.0.3
+     /opt/goenv/release
 
 You can also uninstall Go binaries with ``-u`` option before version number::
 
 
    % goof go go1.0.2
    % goof goinstall
-     /opt/goenv/go
+     /opt/goenv/go (repository)
      /opt/goenv/go1.0.2
    * /opt/goenv/go1.0.3
+     /opt/goenv/release
 
 
 4.3 Advanced option

shellscripts/goenvwrapper.sh

 
   export _PREV_GOROOT="$GOROOT"
   export GOROOT="$GOENVGOROOT/$1"
+  export PATH="$GOROOT/bin:$PATH"
   echo "[goof] changed GOROOT=$GOENVGOROOT/$1"
   return 0
 }

shellscripts/initial-install.sh

-#!/usr/bin/env bash
+#!/usr/bin/env zsh
 #
 # Environment variable GOENVGOROOT, GOENVTARGET is install target of `goenv`
 # Default install target i /usr/local/bin.
 fi
 
 if [ ! -d "$GOENVGOROOT" ]; then
-  if eval "mkdir $GOENVGOROOT"; then
+  if ! eval "mkdir $GOENVGOROOT"; then
     echo "[goenv] please confirm directory permission for GOENVGOROOT"      
     exit 0
   fi
 fi
 
 if [ ! -d "$GOENVTARGET" ]; then
-  if eval "mkdir $GOENVTARGET"; then
+  if ! eval "mkdir $GOENVTARGET"; then
     echo "[goenv] please confirm directory permission for GOENVTARGET"      
     exit 0
   fi
   exit 0
 fi
 
-if goof goinstall default; then
-  if [ -d "$GOENVGOROOT/default" ]; then
+if goof goinstall release; then
+  if [ -d "$GOENVGOROOT/release" ]; then
     echo "[goenv] add following lines in your .barshrc/.zshrc"
-    echo "export GOROOT=$GOENVGOROOT/default"
+    echo "export GOROOT=$GOENVGOROOT/release"
     echo "export PATH=$PATH:$GOROOT/bin"
-    export GOROOT="$GOENVGOROOT/default"
-    export PATH="$GOENVGOROOT/default/bin:$PATH"
+    export GOROOT="$GOENVGOROOT/release"
+    export PATH="$GOENVGOROOT/release/bin:$PATH"
   fi
 else
   echo "[goenv] `goof goinstall` command does not work."
 fi
 
 echo "[goenv] cloning goenv from GitHub"
+if [ -d goenv ]; then
+  if ! eval "rm -rf goenv"; then
+    echo "[goenv] please confirm directory permission for /tmp/goenv"
+    exit 0
+  fi
+fi
 if git clone https://bitbucket.org/ymotongpoo/goenv.git; then
   cd goenv
   if ! go build -o goenv; then