Skip to content

Commit ab0d530

Browse files
committed
refactor: build command paths more efficiently
1 parent 6a0355d commit ab0d530

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

builder.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ func (c CommandInfo) Subcmd(sc CommandInfo) CommandInfo {
146146
panic(errMixingPosArgsAndSubcmds)
147147
}
148148

149-
sc.Path = append([]string(nil), c.Path...)
149+
sc.Path = make([]string, len(c.Path))
150+
copy(sc.Path, c.Path)
150151
sc.Path = append(sc.Path, sc.Name)
151152

152153
c.Subcmds = append(c.Subcmds, sc)

0 commit comments

Comments
 (0)