From 0c68d3126f6475dafd98e6d10d3a8cafac89c16d Mon Sep 17 00:00:00 2001 From: zhulongcheng Date: Wed, 28 Nov 2018 20:45:25 +0800 Subject: [PATCH] PR review changes --- http/task_service.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/http/task_service.go b/http/task_service.go index 1e2f5b8d3f..75d40a3636 100644 --- a/http/task_service.go +++ b/http/task_service.go @@ -560,17 +560,17 @@ func decodeGetRunsRequest(ctx context.Context, r *http.Request, orgs platform.Or req.filter.Limit = i } + var at, bt string var afterTime, beforeTime time.Time - if at := qp.Get("afterTime"); at != "" { + if at = qp.Get("afterTime"); at != "" { afterTime, err = time.Parse(time.RFC3339, at) if err != nil { return nil, err } req.filter.AfterTime = at - } - if bt := qp.Get("beforeTime"); bt != "" { + if bt = qp.Get("beforeTime"); bt != "" { beforeTime, err = time.Parse(time.RFC3339, bt) if err != nil { return nil, err @@ -578,7 +578,7 @@ func decodeGetRunsRequest(ctx context.Context, r *http.Request, orgs platform.Or req.filter.BeforeTime = bt } - if &afterTime != nil && &beforeTime != nil && afterTime.Sub(beforeTime).Nanoseconds() > 0 { + if at != "" && bt != "" && afterTime.Sub(beforeTime).Nanoseconds() > 0 { return nil, kerrors.InvalidDataf("beforeTime must be greater than afterTime") }