apiserver/peerproxy: avoid shadowing math/rand with local variable\n\nThis change renames a local variable named 'rand' to 'endpointIndex' to avoid shadowing the imported math/rand package in peer proxy handler when selecting a random peer endpoint. Behavior is unchanged; this improves readability and prevents future confusion.\n\n/kind cleanup\n/area apiserver\n/sig api-machinery\n\n/release-note-none\n

This commit is contained in:
Rikiya Narita
2025-09-05 02:54:47 +09:00
parent 6f093ef292
commit e7a5f5288f

View File

@@ -177,8 +177,8 @@ func (h *peerProxyHandler) WrapHandler(handler http.Handler) http.Handler {
return
}
rand := rand.Intn(len(peerEndpoints))
peerEndpoint := peerEndpoints[rand]
endpointIndex := rand.Intn(len(peerEndpoints))
peerEndpoint := peerEndpoints[endpointIndex]
h.proxyRequestToDestinationAPIServer(r, w, peerEndpoint)
})
}