@@ -17,6 +17,7 @@ package signing
17
17
import (
18
18
"encoding/json"
19
19
"fmt"
20
+ "slices"
20
21
"strconv"
21
22
"strings"
22
23
@@ -133,7 +134,7 @@ func (relativeKeypath RelativeKeypath) Encode() string {
133
134
134
135
// Child appends the given node to this relative keypath.
135
136
func (relativeKeypath RelativeKeypath ) Child (index uint32 , hardened bool ) RelativeKeypath {
136
- newKeypath := append ( RelativeKeypath {}, relativeKeypath ... )
137
+ newKeypath := slices . Clone ( relativeKeypath )
137
138
return append (newKeypath , keyNode {index , hardened })
138
139
}
139
140
@@ -202,13 +203,13 @@ func (absoluteKeypath AbsoluteKeypath) Encode() string {
202
203
203
204
// Child appends the given node to this absolute keypath.
204
205
func (absoluteKeypath AbsoluteKeypath ) Child (index uint32 , hardened bool ) AbsoluteKeypath {
205
- newKeypath := append ( AbsoluteKeypath {}, absoluteKeypath ... )
206
+ newKeypath := slices . Clone ( absoluteKeypath )
206
207
return append (newKeypath , keyNode {index , hardened })
207
208
}
208
209
209
210
// Append appends a relative keypath to this absolute keypath.
210
211
func (absoluteKeypath AbsoluteKeypath ) Append (suffix RelativeKeypath ) AbsoluteKeypath {
211
- newKeypath := append ( AbsoluteKeypath {}, absoluteKeypath ... )
212
+ newKeypath := slices . Clone ( absoluteKeypath )
212
213
return append (newKeypath , suffix ... )
213
214
}
214
215
0 commit comments