rafthttp: replace append with pre-allocated slice

This commit is contained in:
Gyu-Ho Lee 2016-05-20 15:20:55 -07:00
parent 1226946e2d
commit c9264c5e65

View File

@ -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, ","))
}