|author||doujiang24 <firstname.lastname@example.org>||Fri Jan 21 01:43:20 2022 +0000|
|committer||Hyang-Ah Hana Kim <email@example.com>||Fri Jan 21 13:34:07 2022 +0000|
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 <firstname.lastname@example.org> Reviewed-by: Hyang-Ah Hana Kim <email@example.com> Trust: Hyang-Ah Hana Kim <firstname.lastname@example.org>
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.