[debug] cmd/viewcore: fix commandPath recursion

0 views
Skip to first unread message

Gopher Robot (Gerrit)

unread,
Aug 14, 2026, 10:48:10 PM (2 days ago) Aug 14
to race quite, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Dmitri Shuralyov, Dmitri Shuralyov, golang...@luci-project-accounts.iam.gserviceaccount.com, Keith Randall, Keith Randall, golang-co...@googlegroups.com

Gopher Robot submitted the change

Change information

Commit message:
cmd/viewcore: fix commandPath recursion

commandPath recursively called itself with the same command when the
command had a parent. The recursion therefore never reached the root
command and eventually caused a stack overflow.

Recurse with c.Parent() so each call advances toward the root. Add
table-driven tests covering root, one-level, and two-level command paths.
Change-Id: I8d258a9f2d4d2c42c1cd66df0873fa99185a8aa9
Reviewed-by: Keith Randall <k...@google.com>
Reviewed-by: Keith Randall <k...@golang.org>
Reviewed-by: Dmitri Shuralyov <dmit...@google.com>
Auto-Submit: Keith Randall <k...@golang.org>
Files:
  • M cmd/viewcore/main.go
  • A cmd/viewcore/main_test.go
Change size: S
Delta: 2 files changed, 40 insertions(+), 1 deletion(-)
Branch: refs/heads/master
Submit Requirements:
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: debug
Gerrit-Branch: master
Gerrit-Change-Id: I8d258a9f2d4d2c42c1cd66df0873fa99185a8aa9
Gerrit-Change-Number: 811640
Gerrit-PatchSet: 2
Gerrit-Owner: race quite <quit...@gmail.com>
Gerrit-Reviewer: Dmitri Shuralyov <dmit...@google.com>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
Gerrit-Reviewer: Keith Randall <k...@golang.org>
Gerrit-Reviewer: Keith Randall <k...@google.com>
Gerrit-CC: Dmitri Shuralyov <dmit...@golang.org>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages