Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime/trace: incorrect WithRegion usage in code snippet #27406

Closed
ondrej-fabry opened this issue Aug 31, 2018 · 5 comments
Closed

runtime/trace: incorrect WithRegion usage in code snippet #27406

ondrej-fabry opened this issue Aug 31, 2018 · 5 comments
Labels
Documentation FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@ondrej-fabry
Copy link

ondrej-fabry commented Aug 31, 2018

What version of Go are you using (go version)?

  • 1.11

Does this issue reproduce with the latest release?

  • yes (go1.11)

What did you do?

What did you expect to see?

...
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, "remaining", remainingWork)
}()

What did you see instead?

...
trace.WithRegion(ctx, prepWork)
// preparation of the task
go func() {  // continue processing the task in a separate goroutine.
    defer task.End()
    trace.WithRegion(ctx, remainingWork)
}

The trace.WithRegion requires 3 parameters (ctx, regionType, fn) however in the code snippet for trace.NewTask, it seems to be missing some parameter.

It depends what prepWork and remainingWork represent here, but if they represent function (fn parameter) then this code snippet is misisng regionType parameter.

The code snippet is also missing () for the go func() ... call.

@ondrej-fabry
Copy link
Author

@gopherbot add label Documentation

@FiloSottile FiloSottile added this to the Go1.12 milestone Aug 31, 2018
@FiloSottile FiloSottile added NeedsFix The path to resolution is known, but the work has not been done. help wanted labels Aug 31, 2018
@gopherbot
Copy link

Change https://golang.org/cl/132676 mentions this issue: runtime/trace: document missing params for WithRegion

@0xch4z
Copy link
Contributor

0xch4z commented Sep 1, 2018

I'll take this

@gopherbot
Copy link

Change https://golang.org/cl/132775 mentions this issue: runtime/trace: fix WithRegion usage in NewTask code snippet

@gopherbot
Copy link

Change https://golang.org/cl/134616 mentions this issue: [release-branch.go1.11] runtime/trace: fix syntax errors in NewTask doc example

gopherbot pushed a commit that referenced this issue Sep 11, 2018
…oc example

Fixes #27406

Change-Id: I9c6f5bac5b26558fa7628233c74a62faf676e811
GitHub-Last-Rev: 29d19f7
GitHub-Pull-Request: #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 b794ca6)
Reviewed-on: https://go-review.googlesource.com/134616
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
@golang golang locked and limited conversation to collaborators Sep 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants