mirror of
https://github.com/1f349/site-hosting.git
synced 2025-04-12 22:56:02 +01:00
Modify generateToken to not use make
This commit is contained in:
parent
e227284177
commit
6897df5cd5
@ -152,12 +152,12 @@ func setEnabled(rw http.ResponseWriter, req *http.Request, params httprouter.Par
|
||||
}
|
||||
|
||||
func generateToken() (string, error) {
|
||||
b := make([]byte, 32)
|
||||
_, err := rand.Read(b)
|
||||
var b [32]byte
|
||||
_, err := rand.Read(b[:])
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return hex.EncodeToString(b), nil
|
||||
return hex.EncodeToString(b[:]), nil
|
||||
}
|
||||
|
||||
// apiError outputs a generic JSON error message
|
||||
|
Loading…
x
Reference in New Issue
Block a user