16 lines
201 B
Go
16 lines
201 B
Go
package xcontext
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
)
|
|
|
|
func Wait(ctx context.Context, wait time.Duration) error {
|
|
select {
|
|
case <-ctx.Done():
|
|
return ctx.Err()
|
|
case <-time.After(wait):
|
|
return nil
|
|
}
|
|
}
|