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
|
// often not set in unit tests
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var peerURLs []string
|
peerURLs := make([]string, urls.Len())
|
||||||
for _, url := range urls {
|
for i := range urls {
|
||||||
peerURLs = append(peerURLs, url.String())
|
peerURLs[i] = urls[i].String()
|
||||||
}
|
}
|
||||||
req.Header.Set("X-PeerURLs", strings.Join(peerURLs, ","))
|
req.Header.Set("X-PeerURLs", strings.Join(peerURLs, ","))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user