forked from TrueCloudLab/rclone
staticcheck: should use a simple channel send/receive instead of select with a single case
This commit is contained in:
parent
9612ca6110
commit
92a43c5f7b
1 changed files with 6 additions and 10 deletions
|
@ -107,23 +107,19 @@ var shortFn = func(ctx context.Context, in rc.Params) (rc.Params, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var ctxFn = func(ctx context.Context, in rc.Params) (rc.Params, error) {
|
var ctxFn = func(ctx context.Context, in rc.Params) (rc.Params, error) {
|
||||||
select {
|
<-ctx.Done()
|
||||||
case <-ctx.Done():
|
|
||||||
return nil, ctx.Err()
|
return nil, ctx.Err()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var ctxParmFn = func(paramCtx context.Context, returnError bool) func(ctx context.Context, in rc.Params) (rc.Params, error) {
|
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) {
|
return func(ctx context.Context, in rc.Params) (rc.Params, error) {
|
||||||
select {
|
<-paramCtx.Done()
|
||||||
case <-paramCtx.Done():
|
|
||||||
if returnError {
|
if returnError {
|
||||||
return nil, ctx.Err()
|
return nil, ctx.Err()
|
||||||
}
|
}
|
||||||
return rc.Params{}, nil
|
return rc.Params{}, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
sleepTime = 100 * time.Millisecond
|
sleepTime = 100 * time.Millisecond
|
||||||
|
|
Loading…
Add table
Reference in a new issue