mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
rafthttp: replace append with pre-allocated slice
This commit is contained in:
parent
1226946e2d
commit
c9264c5e65
@ -197,9 +197,9 @@ func setPeerURLsHeader(req *http.Request, urls types.URLs) {
|
||||
// often not set in unit tests
|
||||
return
|
||||
}
|
||||
var peerURLs []string
|
||||
for _, url := range urls {
|
||||
peerURLs = append(peerURLs, url.String())
|
||||
peerURLs := make([]string, urls.Len())
|
||||
for i := range urls {
|
||||
peerURLs[i] = urls[i].String()
|
||||
}
|
||||
req.Header.Set("X-PeerURLs", strings.Join(peerURLs, ","))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user