Don't use Sprintf in Errorf for no reason

pull/55/head
Pancakes 4 months ago
parent 56b94e33c7
commit a3fcec4a4c
No known key found for this signature in database
GPG Key ID: 5792877BFA27DC8F

@ -32,7 +32,7 @@ func ChangePW(uuid []byte, password string) error {
salt := make([]byte, ArgonSaltSize) salt := make([]byte, ArgonSaltSize)
_, err := rand.Read(salt) _, err := rand.Read(salt)
if err != nil { if err != nil {
return fmt.Errorf(fmt.Sprintf("failed to generate salt: %s", err)) return fmt.Errorf("failed to generate salt: %s", err)
} }
err = db.UpdateAccountPassword(uuid, deriveArgon2IDKey([]byte(password), salt), salt) err = db.UpdateAccountPassword(uuid, deriveArgon2IDKey([]byte(password), salt), salt)

@ -20,6 +20,7 @@ package account
import ( import (
"crypto/rand" "crypto/rand"
"fmt" "fmt"
"github.com/pagefaultgames/rogueserver/db" "github.com/pagefaultgames/rogueserver/db"
) )
@ -42,7 +43,7 @@ func Register(username, password string) error {
salt := make([]byte, ArgonSaltSize) salt := make([]byte, ArgonSaltSize)
_, err = rand.Read(salt) _, err = rand.Read(salt)
if err != nil { if err != nil {
return fmt.Errorf(fmt.Sprintf("failed to generate salt: %s", err)) return fmt.Errorf("failed to generate salt: %s", err)
} }
err = db.AddAccountRecord(uuid, username, deriveArgon2IDKey([]byte(password), salt), salt) err = db.AddAccountRecord(uuid, username, deriveArgon2IDKey([]byte(password), salt), salt)

Loading…
Cancel
Save