mirror of
https://github.com/rclone/rclone.git
synced 2026-02-26 17:33:29 +00:00
staticcheck: should use a simple channel send/receive instead of select with a single case
This commit is contained in:
@@ -107,21 +107,17 @@ var shortFn = func(ctx context.Context, in rc.Params) (rc.Params, error) {
|
||||
}
|
||||
|
||||
var ctxFn = func(ctx context.Context, in rc.Params) (rc.Params, error) {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return nil, ctx.Err()
|
||||
}
|
||||
<-ctx.Done()
|
||||
return nil, ctx.Err()
|
||||
}
|
||||
|
||||
var ctxParmFn = func(paramCtx context.Context, returnError bool) func(ctx context.Context, in rc.Params) (rc.Params, error) {
|
||||
return func(ctx context.Context, in rc.Params) (rc.Params, error) {
|
||||
select {
|
||||
case <-paramCtx.Done():
|
||||
if returnError {
|
||||
return nil, ctx.Err()
|
||||
}
|
||||
return rc.Params{}, nil
|
||||
<-paramCtx.Done()
|
||||
if returnError {
|
||||
return nil, ctx.Err()
|
||||
}
|
||||
return rc.Params{}, nil
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user