22287d0153047cf5d5872d294202d9ce35e8eac8

Author
Ilia Choly <icholy@accipiterradar.com>
Committer
Ilia Choly <icholy@accipiterradar.com>
Date

Message

handle multiple paths in GOPATH

Diff

 1diff --git a/plugins/golang/golang.plugin.zsh b/plugins/golang/golang.plugin.zsh
 2index 4e6ca0a99b363791b684d19c6985188a99f3846d..1ce3cea58e861e6540509143d1e3f1913056177e 100644
 3--- a/plugins/golang/golang.plugin.zsh
 4+++ b/plugins/golang/golang.plugin.zsh
 5@@ -55,8 +55,13 @@ __go_tool_complete() {
 6     '-tags[list of build tags to consider satisfied]:tags'
 7   )
 8   __go_packages() {
 9-      _path_files -W "$(go env GOROOT)/src" -/
10-      _path_files -W "$(go env GOPATH)/src" -/
11+      local gopaths
12+      declare -a gopaths
13+      gopaths=("${(s/:/)$(go env GOPATH)}")
14+      gopaths+=("$(go env GOROOT)")
15+      for p in $gopaths; do
16+        _path_files -W "$p/src" -/
17+      done
18   }
19   __go_identifiers() {
20       compadd $(godoc -templates $ZSH/plugins/golang/templates ${words[-2]} 2> /dev/null)