Skip to content

Commit 18de228

Browse files
committed
_golang: switch listing of GOPATH/GOROOT with _call_program (suggestion by @okapia)
1 parent bef2035 commit 18de228

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

src/_golang

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@
4848
#
4949
# * To disable listing packages from GOROOT (i.e. Go stdlib) in completions use:
5050
#
51-
# zstyle ':completion:*:go:*' no-goroot true
51+
# zstyle ':completion:*:go-packages-goroot' command ""
5252
#
5353
# * To disable listing packages from GOPATH in completions use:
5454
#
55-
# zstyle ':completion:*:go:*' no-gopath true
55+
# zstyle ':completion:*:go-packages-gopath' command ""
5656
#
5757
# ------------------------------------------------------------------------------
5858

@@ -370,12 +370,9 @@ case $state in
370370
__go_packages() {
371371
local gopaths
372372
declare -a gopaths
373-
if ! zstyle -t ":completion:${curcontext}:" no-gopath; then
374-
gopaths=("${(s/:/)$(go env GOPATH)}")
375-
fi
376-
if ! zstyle -t ":completion:${curcontext}:" no-goroot; then
377-
gopaths+=("$(go env GOROOT)")
378-
fi
373+
gopaths=()
374+
gopaths+=("${(s/:/)$(_call_program go-packages-gopath go env GOPATH)}")
375+
gopaths+=("${(s/:/)$(_call_program go-packages-goroot go env GOROOT)}")
379376
for p in $gopaths; do
380377
_path_files $@ -W "$p/src" -/
381378
done

0 commit comments

Comments
 (0)