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>
2 files changed
tree: 877e3b7beb7ccce440aa8d3d3aabdc257537a3a3
  1. cmd/
  2. dwtest/
  3. internal/
  4. AUTHORS
  5. codereview.cfg
  6. CONTRIBUTING.md
  7. CONTRIBUTORS
  8. go.mod
  9. go.sum
  10. LICENSE
  11. README.md
README.md

Go Debug

Go Reference

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.

Report Issues / Send Patches

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.