From 49044a25a819fcc5272644cb3dead2a07be2b412 Mon Sep 17 00:00:00 2001 From: Paul Seyfert Date: Mon, 2 Mar 2020 16:37:06 +0100 Subject: [PATCH] attempt to patch list --- src/_golang | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/_golang b/src/_golang index 9c8a799..28419c0 100644 --- a/src/_golang +++ b/src/_golang @@ -43,8 +43,6 @@ # # ------------------------------------------------------------------------------ -typeset -A opt_args - __go_buildmodes() { local -a buildmodes buildmodes=( @@ -103,7 +101,7 @@ case $state in '-buildmode[build mode to use]:mode:__go_buildmodes' '-compiler[name of compiler to use]:name' '-gccgoflags[arguments for gccgo]:args' - '-gcflags[arguments for each go tool compile invocation]:args' + '-gcflags=[arguments for each go tool compile invocation]:args' '-installsuffix[suffix to add to package directory]:suffix' '-ldflags[arguments to pass on each go tool link invocation.]:flags' '-linkshared[link against shared libraries]' @@ -260,15 +258,26 @@ case $state in ;; list) - _arguments \ - '-e[changes the handling of erroneous packages]' \ - '-f[specifies an alternate format for the list]:format' \ - '-json[causes package data to be printed in JSON format]' \ - '-compiled[set CompiledGoFiles to the Go source files presented to the compiler]' \ - '-deps[iterate over named packages and their dependencies]' \ - '-m[list modules instead of packages]' \ - ${build_flags[@]} \ + # TODO: if statement does not work atm + local -a list_args + list_args=( + '-e[changes the handling of erroneous packages]' + '-f[specifies an alternate format for the list]:format' + '-json[causes package data to be printed in JSON format]' + '-compiled[set CompiledGoFiles to the Go source files presented to the compiler]' + '-deps[iterate over named packages and their dependencies]' + '-m[list modules instead of packages]' + ${build_flags[@]} + ${mod_flags[@]} '*:importpaths:__go_packages' + ) + if [[ -n ${opt_args[(I)-m]} ]]; then + list_args+=( + '-u[adds information about available upgrades]' + '-versions[list all known versions of modules]' + ) + fi + _arguments ${list_args[@]} ;; mod)