petejkim / goop

A simple dependency manager for Go (golang), inspired by Bundler.
MIT License
779 stars 45 forks source link

Some minor tweaks around env activation #9

Closed alecthomas closed 6 years ago

alecthomas commented 10 years ago

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:

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