Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Improve info commands

* List only shows the workspace paths
* env added to show environment variables (GOROOT and GOPATH)
* which shows the current workspace based on the working directory
  • Loading branch information...
commit 5c33b1f7097edbcceb45db9115f5884a03d6bd33 1 parent a679ddf
@ascarter authored
Showing with 10 additions and 9 deletions.
  1. +10 −9 goenv
View
19 goenv
@@ -12,6 +12,7 @@ _goenv_help() {
print "\treset reset to workspace to empty"
print "\tlist list all workspace paths"
print "\twhich show current Go workspace"
+ print "\tenv environment variables for workspace
print "\ngoenv manages the workspace by setting the GOPATH environment variable"
print "When setting or adding a workspace, goenv will search up the path"
print "to find the parent with the required GOPATH entries of bin, pkg, and"
@@ -122,10 +123,9 @@ _goenv_reset() {
_goenv_list() {
if [[ -n "$GOPATH" ]]; then
- print "Go workspace paths:"
items=(`_goenv_split $GOPATH ":"`)
for item in "${items[@]}"; do
- print "\t$item"
+ print "$item"
done
else
print "Go workspace not set"
@@ -133,14 +133,12 @@ _goenv_list() {
}
_goenv_which() {
- if [[ -n "$GOPATH" ]]; then
- print "Go workspace environment:"
+ echo `_goenv_find_ws_path`
+}
+
+_goenv_env() {
print "GOPATH=$GOPATH"
- print "GOROOT=$GOROOT"
- print "PATH=$PATH"
- else
- print "Go workspace not set"
- fi
+ print "GOROOT=$GOROOT"
}
_goenv_exec() {
@@ -198,6 +196,9 @@ goenv() {
which)
_goenv_which
;;
+ env)
+ _goenv_env
+ ;;
help | *)
_goenv_help
;;
Please sign in to comment.
Something went wrong with that request. Please try again.