Skip to content

Instantly share code, notes, and snippets.

@flimzy
Created April 12, 2018 11:46
Show Gist options
  • Save flimzy/97b2cb1710f842c94ba4977ddbba6c89 to your computer and use it in GitHub Desktop.
Save flimzy/97b2cb1710f842c94ba4977ddbba6c89 to your computer and use it in GitHub Desktop.
func (h *handler) GetData(ctx context.Context, request Payload) (*Data, error) {
go func(ctx context.Context) {
<-ctx.Done()
if ctx.Err() == context.Canceled {
log.Info(ctx.Err())
}
}(ctx)
data := fetchData(request)
return data, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment