Răsfoiți Sursa

fix new lint warnings

Signed-off-by: Nicola Murino <[email protected]>
Nicola Murino 11 luni în urmă
părinte
comite
f3a58b8ecc
3 a modificat fișierele cu 14 adăugiri și 14 ștergeri
  1. 4 4
      internal/common/eventmanager.go
  2. 2 2
      internal/sftpd/server.go
  3. 8 8
      internal/util/errors.go

+ 4 - 4
internal/common/eventmanager.go

@@ -1782,7 +1782,7 @@ func executeRenameFsActionForUser(renames []dataprovider.KeyValue, replacer *str
 	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)
@@ -1796,7 +1796,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, "/") {
@@ -1870,7 +1870,7 @@ func executeRenameFsRuleAction(renames []dataprovider.KeyValue, replacer *string
 	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()
@@ -1889,7 +1889,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)
 		}

+ 2 - 2
internal/sftpd/server.go

@@ -399,8 +399,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)

+ 8 - 8
internal/util/errors.go

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