Rename function

This commit is contained in:
2024-12-30 23:15:25 +01:00
parent e446d4f747
commit 3074d0de93

View File

@ -44,7 +44,7 @@ func (app *application) createElection(w http.ResponseWriter, r *http.Request) {
if request.AreVotersKnown {
voterIdentities := make([]string, 0, request.MaxVoters)
for i := 0; i < request.MaxVoters; i++ {
randomIdentity := generateRandomVoterIdentity()
randomIdentity := randomVoterIdentity()
_, err := app.voters.Insert(randomIdentity, electionId)
if err != nil {
app.serverError(w, r, err)
@ -77,7 +77,7 @@ func isRequestValid(r *createElectionRequestWithValidator) bool {
return r.Valid()
}
func generateRandomVoterIdentity() string {
func randomVoterIdentity() string {
const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
b := make([]byte, 16)
for i := range b {