Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

x/tools/internal/cmd/deadcode: add -why=symbol flag to report path from root #61263

Closed
adonovan opened this issue Jul 10, 2023 · 3 comments
Closed
Assignees
Labels
FrozenDueToAge Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@adonovan
Copy link
Member

@thanm suggests: "If you are looking for ways to improve it, here is a feature request: allow a user to pass in a symbol (ex: "k8s.io/kubernetes/pkg/scheduler/framework.NewCycleState") and have the tool print the sequence of symbols that led the target to be marked live."

@adonovan adonovan self-assigned this Jul 10, 2023
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Jul 10, 2023
@gopherbot gopherbot added this to the Unreleased milestone Jul 10, 2023
@adonovan adonovan changed the title x/tools/internal/cmd/callgraph: add -why=symbol flag to report path from root x/tools/internal/cmd/deadcode: add -why=symbol flag to report path from root Jul 10, 2023
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/540219 mentions this issue: internal/cmd/deadcode: add -whylive=function flag

@adonovan
Copy link
Member Author

adonovan commented Nov 7, 2023

Example output on the function mentioned above:

kubernetes$ deadcode -whylive=k8s.io/kubernetes/pkg/scheduler/framework.NewCycleState  ./cmd/... 
			k8s.io/kubernetes/cmd/kubectl-convert.main
 ---static-L0041-->	k8s.io/component-base/cli.Run
 ---static-L0072-->	fmt.Fprintf
 --dynamic-L0225-->	(net/http.checkConnErrorWriter).Write
 --dynamic-L3602-->	k8s.io/client-go/util/workqueue.ParallelizeUntil$1
 --dynamic-L0090-->	(*k8s.io/kubernetes/pkg/scheduler/framework/preemption.Evaluator).DryRunPreemption$1
 ---static-L0557-->	(*k8s.io/kubernetes/pkg/scheduler/framework.CycleState).Clone
 ---static-L0080-->	k8s.io/kubernetes/pkg/scheduler/framework.NewCycleState

@thanm
Copy link
Contributor

thanm commented Nov 8, 2023

This looks great, thank you!

@golang golang locked and limited conversation to collaborators Nov 7, 2024
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
FrozenDueToAge Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants