Skip to content

Commit

Permalink
fix lint warning
Browse files Browse the repository at this point in the history
  • Loading branch information
vvakame committed Oct 31, 2018
1 parent b2ba5f8 commit a905efa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions gqlapollotracing/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

type tracingData struct {
mu sync.Mutex `json:"-"`
mu sync.Mutex

StartTime time.Time `json:"startTime"`
EndTime time.Time `json:"endTime"`
Expand All @@ -17,7 +17,7 @@ type tracingData struct {
}

func (td *tracingData) prepare() {
td.Duration = time.Time(td.EndTime).Sub(time.Time(td.StartTime))
td.Duration = td.EndTime.Sub(td.StartTime)
if td.Parsing != nil {
td.Parsing.prepare(td)
}
Expand All @@ -38,7 +38,7 @@ type startOffset struct {
}

func (so *startOffset) prepare(td *tracingData) {
so.StartOffset = time.Time(so.StartTime).Sub(time.Time(td.StartTime))
so.StartOffset = so.StartTime.Sub(td.StartTime)
so.Duration = so.EndTime.Sub(so.StartTime)
}

Expand Down
5 changes: 4 additions & 1 deletion gqlapollotracing/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ func RequestMiddleware() graphql.RequestMiddleware {
td := getTracingData(ctx)
td.prepare()

reqCtx.RegisterExtension("tracing", td)
err := reqCtx.RegisterExtension("tracing", td)
if err != nil {
reqCtx.Error(ctx, err)
}

return res
}
Expand Down

0 comments on commit a905efa

Please sign in to comment.