Commit b794ca64 authored by Charles Kenney's avatar Charles Kenney Committed by Emmanuel Odeke

runtime/trace: fix syntax errors in NewTask doc example

Fixes #27406

Change-Id: I9c6f5bac5b26558fa7628233c74a62faf676e811
GitHub-Last-Rev: 29d19f719316b486224a15a50556465811985edf
GitHub-Pull-Request: golang/go#27437
Reviewed-on: https://go-review.googlesource.com/132775Reviewed-by: 's avatarEmmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 860484a1
......@@ -24,13 +24,13 @@ type traceContextKey struct{}
// If the end function is called multiple times, only the first
// call is used in the latency measurement.
//
// ctx, task := trace.NewTask(ctx, "awesome task")
// trace.WithRegion(ctx, prepWork)
// ctx, task := trace.NewTask(ctx, "awesomeTask")
// trace.WithRegion(ctx, "preparation", prepWork)
// // preparation of the task
// go func() { // continue processing the task in a separate goroutine.
// defer task.End()
// trace.WithRegion(ctx, remainingWork)
// }
// trace.WithRegion(ctx, "remainingWork", remainingWork)
// }()
func NewTask(pctx context.Context, taskType string) (ctx context.Context, task *Task) {
pid := fromContext(pctx).id
id := newID()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment