nitrous-io/goop — pull request #9 by alecthomas (2014-06-30 06:43:04+00:00)
Title: Some minor tweaks around env activation

This fixes #4 (set GOBIN) and #8 (replace GOPATH), and adds a "deactivate" command similar to the same command in virtualenv.

You may or may not be interested in these changes, but I thought I'd throw them out there. A couple of thoughts:

- `deactivate` is definitely useful, but only works for Bourne shell variants (sh, bash, zsh). Won't work for csh, fish, etc. It would be a bit more work to make it work across shells.
- I'm not sure what your opinion on #4 and #8 are, so you might not want those changes. I can back them out.

eg.

Activate an environment:

```
~/Projects/3rdParty/goop$ goop env
_OLD_GOPATH="$GOPATH"
_OLD_GOBIN="$GOBIN"
_OLD_PATH="$PATH"
GOPATH=/Users/alec/Projects/3rdParty/goop/.vendor
GOBIN=/Users/alec/Projects/3rdParty/goop/.vendor/bin
PATH=/Users/alec/Projects/3rdParty/goop/.vendor/bin:/usr/local/bin:/usr/local/go/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/alec/.cabal/bin
```

Deactivate an environment:

```
~/Projects/3rdParty/goop$ goop deactivate
GOPATH="$_OLD_GOPATH"
unset _OLD_GOPATH
GOBIN="$_OLD_GOBIN"
unset _OLD_GOBIN
PATH="$_OLD_PATH"
unset _OLD_PATH
```