fix revive reported issues

This commit is contained in:
cubicroot 2024-10-20 20:26:04 +02:00
parent 8bdd7166b8
commit 05916239c7
3 changed files with 6 additions and 6 deletions

View file

@ -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
})
}

View file

@ -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")
}

View file

@ -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]
}