mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 14:50:55 +03:00
fix new lint warnings
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -1782,7 +1782,7 @@ func executeRenameFsActionForUser(renames []dataprovider.KeyValue, replacer *str
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func executeCopyFsActionForUser(copy []dataprovider.KeyValue, replacer *strings.Replacer,
|
func executeCopyFsActionForUser(keyVals []dataprovider.KeyValue, replacer *strings.Replacer,
|
||||||
user dataprovider.User,
|
user dataprovider.User,
|
||||||
) error {
|
) error {
|
||||||
user, err := getUserForEventAction(user)
|
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)
|
return fmt.Errorf("copy error, unable to check root fs for user %q: %w", user.Username, err)
|
||||||
}
|
}
|
||||||
conn := NewBaseConnection(connectionID, protocolEventAction, "", "", user)
|
conn := NewBaseConnection(connectionID, protocolEventAction, "", "", user)
|
||||||
for _, item := range copy {
|
for _, item := range keyVals {
|
||||||
source := util.CleanPath(replaceWithReplacer(item.Key, replacer))
|
source := util.CleanPath(replaceWithReplacer(item.Key, replacer))
|
||||||
target := util.CleanPath(replaceWithReplacer(item.Value, replacer))
|
target := util.CleanPath(replaceWithReplacer(item.Value, replacer))
|
||||||
if strings.HasSuffix(item.Key, "/") {
|
if strings.HasSuffix(item.Key, "/") {
|
||||||
@@ -1870,7 +1870,7 @@ func executeRenameFsRuleAction(renames []dataprovider.KeyValue, replacer *string
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func executeCopyFsRuleAction(copy []dataprovider.KeyValue, replacer *strings.Replacer,
|
func executeCopyFsRuleAction(keyVals []dataprovider.KeyValue, replacer *strings.Replacer,
|
||||||
conditions dataprovider.ConditionOptions, params *EventParams,
|
conditions dataprovider.ConditionOptions, params *EventParams,
|
||||||
) error {
|
) error {
|
||||||
users, err := params.getUsers()
|
users, err := params.getUsers()
|
||||||
@@ -1889,7 +1889,7 @@ func executeCopyFsRuleAction(copy []dataprovider.KeyValue, replacer *strings.Rep
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
executed++
|
executed++
|
||||||
if err = executeCopyFsActionForUser(copy, replacer, user); err != nil {
|
if err = executeCopyFsActionForUser(keyVals, replacer, user); err != nil {
|
||||||
failures = append(failures, user.Username)
|
failures = append(failures, user.Username)
|
||||||
params.AddError(err)
|
params.AddError(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -399,8 +399,8 @@ func (c *Configuration) serve(listener net.Listener, serverConfig *ssh.ServerCon
|
|||||||
} else {
|
} else {
|
||||||
tempDelay *= 2
|
tempDelay *= 2
|
||||||
}
|
}
|
||||||
if max := 1 * time.Second; tempDelay > max {
|
if maxDelay := 1 * time.Second; tempDelay > maxDelay {
|
||||||
tempDelay = max
|
tempDelay = maxDelay
|
||||||
}
|
}
|
||||||
logger.Warn(logSender, "", "accept error: %v; retrying in %v", err, tempDelay)
|
logger.Warn(logSender, "", "accept error: %v; retrying in %v", err, tempDelay)
|
||||||
time.Sleep(tempDelay)
|
time.Sleep(tempDelay)
|
||||||
|
|||||||
@@ -59,9 +59,9 @@ func (e *ValidationError) Is(target error) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewValidationError returns a validation errors
|
// NewValidationError returns a validation errors
|
||||||
func NewValidationError(error string) *ValidationError {
|
func NewValidationError(errorString string) *ValidationError {
|
||||||
return &ValidationError{
|
return &ValidationError{
|
||||||
err: error,
|
err: errorString,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,9 +81,9 @@ func (e *RecordNotFoundError) Is(target error) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewRecordNotFoundError returns a not found error
|
// NewRecordNotFoundError returns a not found error
|
||||||
func NewRecordNotFoundError(error string) *RecordNotFoundError {
|
func NewRecordNotFoundError(errorString string) *RecordNotFoundError {
|
||||||
return &RecordNotFoundError{
|
return &RecordNotFoundError{
|
||||||
err: error,
|
err: errorString,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,9 +106,9 @@ func (e *MethodDisabledError) Is(target error) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewMethodDisabledError returns a method disabled error
|
// NewMethodDisabledError returns a method disabled error
|
||||||
func NewMethodDisabledError(error string) *MethodDisabledError {
|
func NewMethodDisabledError(errorString string) *MethodDisabledError {
|
||||||
return &MethodDisabledError{
|
return &MethodDisabledError{
|
||||||
err: error,
|
err: errorString,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,8 +128,8 @@ func (e *GenericError) Is(target error) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewGenericError returns a generic error
|
// NewGenericError returns a generic error
|
||||||
func NewGenericError(error string) *GenericError {
|
func NewGenericError(errorString string) *GenericError {
|
||||||
return &GenericError{
|
return &GenericError{
|
||||||
err: error,
|
err: errorString,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user