Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/cmd/deadcode: add -whylive=function flag
The -whylive flag explains why a function is live (not dead code), by displaying an arbitrary shortest path to the function from one of the main entrypoints. Call paths from main packages (not tests), from main functions (not init functions), and involving only static calls are preferred. The output logic is unified so that the usual mode and -whylive both compute a list of JSON objects, which are then formatted by -json or -format=template. Also, a test. Also, fix the test framework to correctly handle a sequence of commands(!). Fixes golang/go#61263 Change-Id: I6aafc851c9c57e27a0a8f0d723e20fb2f8b57ad7 Reviewed-on: https://go-review.googlesource.com/c/tools/+/540219 Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
- Loading branch information