mirror of
https://github.com/pushbits/server.git
synced 2025-05-02 11:46:17 +02:00
fix revive reported issues
This commit is contained in:
parent
8bdd7166b8
commit
05916239c7
3 changed files with 6 additions and 6 deletions
|
@ -61,7 +61,7 @@ func (a *Authenticator) requireUserProperty(has hasUserProperty) gin.HandlerFunc
|
|||
|
||||
// RequireUser returns a Gin middleware which requires valid user credentials to be supplied with the request.
|
||||
func (a *Authenticator) RequireUser() gin.HandlerFunc {
|
||||
return a.requireUserProperty(func(user *model.User) bool {
|
||||
return a.requireUserProperty(func(_ *model.User) bool {
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
|
|
@ -13,9 +13,9 @@ var (
|
|||
)
|
||||
|
||||
func randIntn(n int) int {
|
||||
max := big.NewInt(int64(n))
|
||||
maxValue := big.NewInt(int64(n))
|
||||
|
||||
res, err := rand.Int(rand.Reader, max)
|
||||
res, err := rand.Int(rand.Reader, maxValue)
|
||||
if err != nil {
|
||||
panic("random source is not available")
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@ import (
|
|||
"encoding/base64"
|
||||
)
|
||||
|
||||
func randStr(len int) string {
|
||||
buff := make([]byte, len)
|
||||
func randStr(length int) string {
|
||||
buff := make([]byte, length)
|
||||
|
||||
_, err := rand.Read(buff)
|
||||
if err != nil {
|
||||
|
@ -16,5 +16,5 @@ func randStr(len int) string {
|
|||
str := base64.StdEncoding.EncodeToString(buff)
|
||||
|
||||
// Base 64 can be longer than len
|
||||
return str[:len]
|
||||
return str[:length]
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue