zsh で Go のコマンド補完

.zshrc に以下を追記


# Go completion
if [ -f $GOROOT/misc/zsh/go ]; then
source $GOROOT/misc/zsh/go
fi

以下のようにコマンド候補が出る。


$ go [Tab]
build -- compile packages and dependencies
clean -- remove object files
doc -- run godoc on package sources
env -- print Go environment information
fix -- run go tool fix on packages
fmt -- run gofmt on package sources
get -- download and install packages and dependencies
help -- display help
install -- compile and install packages and dependencies
list -- list packages
run -- compile and run Go program
test -- test packages
tool -- run specified go tool
version -- print Go version
vet -- run go tool vet on packages