commit | 1a07ae6bf58c0a6cf1f877bcb6816b3000bea144 | [log] [tgz] |
---|---|---|
author | doujiang24 <doujiang24@gmail.com> | Fri Jan 21 01:43:20 2022 +0000 |
committer | Hyang-Ah Hana Kim <hyangah@gmail.com> | Fri Jan 21 13:34:07 2022 +0000 |
tree | 877e3b7beb7ccce440aa8d3d3aabdc257537a3a3 | |
parent | 1313148ef665cc9adabb651710efe75b8d14009d [diff] |
cmd/viewcore: reset the flag values before executing subcommands after executing a subcommand with --help flag one time, the subcommand will always show the help usage even it doesn't have the help flag, since the help flag is always true after it's set to true once. as the following case, the `top` flag won't work after executing `histo --help` once. ``` (viewcore) histo --help print histogram of heap memory use by Go type. If N is specified, it will reports only the top N buckets based on the total bytes. Usage: histogram [flags] Aliases: histogram, histo Flags: -h, --help help for histogram --top int reports only top N entries if N>0 (viewcore) histo --top 10 print histogram of heap memory use by Go type. If N is specified, it will reports only the top N buckets based on the total bytes. Usage: histogram [flags] Aliases: histogram, histo Flags: -h, --help help for histogram --top int reports only top N entries if N>0 ``` The original `ResetFlags` just delete the flags of the `root` command. https://pkg.go.dev/github.com/spf13/cobra#Command.ResetFlags https://github.com/spf13/cobra/issues/1488 Change-Id: Ib0c663846fe64512d29636c0d70afa1ba924828a GitHub-Last-Rev: 328b3b6ec9313a5df8991751bfef11d4c119e84d GitHub-Pull-Request: golang/debug#8 Reviewed-on: https://go-review.googlesource.com/c/debug/+/372374 Trust: Heschi Kreinick <heschi@google.com> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com> Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
This repository holds utilities and libraries for debugging Go programs.
WARNING! Please expect breaking changes and unstable APIs. Most of them are currently are at an early, experimental stage.
This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://golang.org/doc/contribute.html.
The main issue tracker for the debug repository is located at https://github.com/golang/go/issues. Prefix your issue with “x/debug:” in the subject line, so it is easy to find.