fix golint issues in core/contextx (#477)

This commit is contained in:
Kevin Wan
2021-02-18 18:00:20 +08:00
committed by GitHub
parent 425be6b4a1
commit f6894448bd
3 changed files with 4 additions and 0 deletions

View File

@@ -5,6 +5,8 @@ import (
"time"
)
// ShrinkDeadline returns a new Context with proper deadline base on the given ctx and timeout.
// And returns a cancel function as well.
func ShrinkDeadline(ctx context.Context, timeout time.Duration) (context.Context, func()) {
if deadline, ok := ctx.Deadline(); ok {
leftTime := time.Until(deadline)