From eb64006fcbc601598706ecfcd358fba00a6a54ec Mon Sep 17 00:00:00 2001 From: yanghuiwen Date: Wed, 6 Jan 2021 12:13:30 +0800 Subject: [PATCH] remove unnecessary code --- _examples/mvc/error-handler-preflight/main.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/_examples/mvc/error-handler-preflight/main.go b/_examples/mvc/error-handler-preflight/main.go index 1ffd8fb6..e25ab5e2 100644 --- a/_examples/mvc/error-handler-preflight/main.go +++ b/_examples/mvc/error-handler-preflight/main.go @@ -30,8 +30,8 @@ type response struct { } func (r *response) Preflight(ctx iris.Context) error { - if (*r).ID > 0 { - (*r).Timestamp = time.Now().Unix() + if r.ID > 0 { + r.Timestamp = time.Now().Unix() } if code := r.Code; code > 0 { @@ -46,7 +46,7 @@ func (r *response) Preflight(ctx iris.Context) error { Code: code, /* use any r.Data as the template data OR the whole "response" as its data. */ - Data: *r, + Data: r, /* automatically pick the template per error (just for the sake of the example) */ Name: fmt.Sprintf("%d", code), }.Dispatch(ctx) @@ -54,7 +54,7 @@ func (r *response) Preflight(ctx iris.Context) error { return iris.ErrStopExecution } - ctx.StatusCode((*r).Code) + ctx.StatusCode(r.Code) } return nil