aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kenney <charlesc.kenney@gmail.com>2018-09-03 07:02:03 +0000
committerAndrew Bonventre <andybons@golang.org>2018-09-11 15:41:45 +0000
commiteeaf877114a2f60dfae7b5c5411ab884ba2a4757 (patch)
tree83370b21ae4f5b880f026d5a867750ab65d04e36
parent71fce844b529e438eb35ca6f0c5173f7c10981b2 (diff)
downloadgo-eeaf877114a2f60dfae7b5c5411ab884ba2a4757.tar.gz
go-eeaf877114a2f60dfae7b5c5411ab884ba2a4757.zip
[release-branch.go1.11] 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/132775 Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com> Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> (cherry picked from commit b794ca64d29f3e584cbdf49bde7141d3c12dd2ab) Reviewed-on: https://go-review.googlesource.com/134616 Run-TryBot: Andrew Bonventre <andybons@golang.org> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
-rw-r--r--src/runtime/trace/annotation.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/runtime/trace/annotation.go b/src/runtime/trace/annotation.go
index 3545ef3bba..d5a7d003fe 100644
--- a/src/runtime/trace/annotation.go
+++ b/src/runtime/trace/annotation.go
@@ -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()