fix new lint warnings

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino 2024-11-10 20:58:22 +01:00
parent 7bffed712a
commit f22ec2275f
No known key found for this signature in database
GPG key ID: 935D2952DEC4EECF
3 changed files with 14 additions and 14 deletions

View file

@ -1790,7 +1790,7 @@ func executeRenameFsActionForUser(renames []dataprovider.RenameConfig, replacer
return nil
}
func executeCopyFsActionForUser(copy []dataprovider.KeyValue, replacer *strings.Replacer,
func executeCopyFsActionForUser(keyVals []dataprovider.KeyValue, replacer *strings.Replacer,
user dataprovider.User,
) error {
user, err := getUserForEventAction(user)
@ -1804,7 +1804,7 @@ func executeCopyFsActionForUser(copy []dataprovider.KeyValue, replacer *strings.
return fmt.Errorf("copy error, unable to check root fs for user %q: %w", user.Username, err)
}
conn := NewBaseConnection(connectionID, protocolEventAction, "", "", user)
for _, item := range copy {
for _, item := range keyVals {
source := util.CleanPath(replaceWithReplacer(item.Key, replacer))
target := util.CleanPath(replaceWithReplacer(item.Value, replacer))
if strings.HasSuffix(item.Key, "/") {
@ -1878,7 +1878,7 @@ func executeRenameFsRuleAction(renames []dataprovider.RenameConfig, replacer *st
return nil
}
func executeCopyFsRuleAction(copy []dataprovider.KeyValue, replacer *strings.Replacer,
func executeCopyFsRuleAction(keyVals []dataprovider.KeyValue, replacer *strings.Replacer,
conditions dataprovider.ConditionOptions, params *EventParams,
) error {
users, err := params.getUsers()
@ -1897,7 +1897,7 @@ func executeCopyFsRuleAction(copy []dataprovider.KeyValue, replacer *strings.Rep
}
}
executed++
if err = executeCopyFsActionForUser(copy, replacer, user); err != nil {
if err = executeCopyFsActionForUser(keyVals, replacer, user); err != nil {
failures = append(failures, user.Username)
params.AddError(err)
}

View file

@ -400,8 +400,8 @@ func (c *Configuration) serve(listener net.Listener, serverConfig *ssh.ServerCon
} else {
tempDelay *= 2
}
if max := 1 * time.Second; tempDelay > max {
tempDelay = max
if maxDelay := 1 * time.Second; tempDelay > maxDelay {
tempDelay = maxDelay
}
logger.Warn(logSender, "", "accept error: %v; retrying in %v", err, tempDelay)
time.Sleep(tempDelay)

View file

@ -59,9 +59,9 @@ func (e *ValidationError) Is(target error) bool {
}
// NewValidationError returns a validation errors
func NewValidationError(error string) *ValidationError {
func NewValidationError(errorString string) *ValidationError {
return &ValidationError{
err: error,
err: errorString,
}
}
@ -81,9 +81,9 @@ func (e *RecordNotFoundError) Is(target error) bool {
}
// NewRecordNotFoundError returns a not found error
func NewRecordNotFoundError(error string) *RecordNotFoundError {
func NewRecordNotFoundError(errorString string) *RecordNotFoundError {
return &RecordNotFoundError{
err: error,
err: errorString,
}
}
@ -106,9 +106,9 @@ func (e *MethodDisabledError) Is(target error) bool {
}
// NewMethodDisabledError returns a method disabled error
func NewMethodDisabledError(error string) *MethodDisabledError {
func NewMethodDisabledError(errorString string) *MethodDisabledError {
return &MethodDisabledError{
err: error,
err: errorString,
}
}
@ -128,8 +128,8 @@ func (e *GenericError) Is(target error) bool {
}
// NewGenericError returns a generic error
func NewGenericError(error string) *GenericError {
func NewGenericError(errorString string) *GenericError {
return &GenericError{
err: error,
err: errorString,
}
}