Skip to content

Commit c538b4e

Browse files
committed
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 <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent b753e58 commit c538b4e

File tree

5 files changed

+441
-119
lines changed

5 files changed

+441
-119
lines changed

0 commit comments

Comments
 (0)