Merge pull request #957 from zsh-users/update-go-1.20

Update go1.20
This commit is contained in:
Shohei YOSHIDA 2022-12-12 22:45:28 +09:00 committed by GitHub
commit 12e788f4a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 4 deletions

View File

@ -30,7 +30,7 @@
# Description # Description
# ----------- # -----------
# #
# Completion script for go 1.19 (https://go.dev/). # Completion script for go 1.20 (https://go.dev/).
# #
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Authors # Authors
@ -176,6 +176,11 @@ __go_gcflags() {
'-wb[enable write barrier (default true)]' \ '-wb[enable write barrier (default true)]' \
} }
__go_pgo() {
_alternative \
"name:name:(all off)" \
"file:file:_files"
}
local -a commands build_flags local -a commands build_flags
commands=( commands=(
@ -337,6 +342,7 @@ _arguments \
case $state in case $state in
args) args)
build_flags=( build_flags=(
'-C[change to directory before running the command]: :_files -/'
'-a[force rebuilding of packages that are already up-to-date]' '-a[force rebuilding of packages that are already up-to-date]'
'-n[print the commands but do not run them]' '-n[print the commands but do not run them]'
'-p[number of builds that can be run in parallel]:number' '-p[number of builds that can be run in parallel]:number'
@ -356,6 +362,7 @@ case $state in
'-ldflags[arguments to pass on each go tool link invocation.]:flags' '-ldflags[arguments to pass on each go tool link invocation.]:flags'
'-linkshared[link against shared libraries]' '-linkshared[link against shared libraries]'
'-overlay[read a JSON config file that provides an overlay for build operations]:file:_files -g "*.json"' '-overlay[read a JSON config file that provides an overlay for build operations]:file:_files -g "*.json"'
'-pgo[specify the file path of a profile for profile-guided optimization]: :__go_pgo'
'-pkgdir[install and load all packages from dir]:dir' '-pkgdir[install and load all packages from dir]:dir'
'-tags[list of build tags to consider satisfied]:tags' '-tags[list of build tags to consider satisfied]:tags'
'-trimpath[remove all file system paths from the resulting executable]' '-trimpath[remove all file system paths from the resulting executable]'
@ -402,7 +409,6 @@ case $state in
build) build)
_arguments \ _arguments \
'-o[force build to write to named output file or directory]:file or directory:_files' \ '-o[force build to write to named output file or directory]:file or directory:_files' \
'-i[installs the packages that are dependencies of the target]' \
${build_flags[@]} \ ${build_flags[@]} \
${mod_flags[@]} \ ${mod_flags[@]} \
'*:importpaths:__go_packages' '*:importpaths:__go_packages'
@ -502,6 +508,7 @@ case $state in
# the ^ parameter expansion appends ": __go_envvarvals" to every element of goenvvars # the ^ parameter expansion appends ": __go_envvarvals" to every element of goenvvars
# the :# parameter expansion removes all elements matching GOENV* # the :# parameter expansion removes all elements matching GOENV*
[[ $words[2] != '-w' ]] && _arguments \ [[ $words[2] != '-w' ]] && _arguments \
'-C[change to directory before running the command]: :_files -/' \
'-json[print the environment in JSON format]' \ '-json[print the environment in JSON format]' \
'-u[unset environment variables]' \ '-u[unset environment variables]' \
'-w[change the default setting of environment variables]' \ '-w[change the default setting of environment variables]' \
@ -510,11 +517,14 @@ case $state in
;; ;;
fix) fix)
_arguments '*:importpaths:__go_packages' _arguments \
'-C[change to directory before running the command]: :_files -/' \
'*:importpaths:__go_packages'
;; ;;
fmt) fmt)
_arguments \ _arguments \
'-C[change to directory before running the command]: :_files -/' \
'-n[prints commands that would be executed]' \ '-n[prints commands that would be executed]' \
'-x[prints commands as they are executed]' \ '-x[prints commands as they are executed]' \
'*:importpaths:__go_packages' '*:importpaths:__go_packages'
@ -522,6 +532,7 @@ case $state in
generate) generate)
_arguments \ _arguments \
'-C[change to directory before running the command]: :_files -/' \
'-run=[specifies a regular expression to select directives]:regex' \ '-run=[specifies a regular expression to select directives]:regex' \
'-x[print the commands]' \ '-x[print the commands]' \
'-n[print the commands but do not run them]' \ '-n[print the commands but do not run them]' \
@ -684,7 +695,6 @@ case $state in
else else
_arguments \ _arguments \
"-c[compile but don't run test]" \ "-c[compile but don't run test]" \
'-i[install dependencies of the test]' \
'-bench[run benchmarks matching the regular expression]:regexp' \ '-bench[run benchmarks matching the regular expression]:regexp' \
'-benchmem[print memory allocation statistics for benchmarks]' \ '-benchmem[print memory allocation statistics for benchmarks]' \
'-benchtime[run benchmarks for t rime]:t' \ '-benchtime[run benchmarks for t rime]:t' \