-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
cmd/cover, cmd/go: go test reports wrong compiler error line numbers when using -coverprofile #6329
Labels
Milestone
Comments
The source rewriting done by the coverage tool, coupled with the inability to add line directives to the output via the AST, makes this very hard if not exactly impossible to fix. Since the coverage tool isn't much use until your program can be compiled and run, the problem isn't worth the attention a fix would require. If it becomes possible to add comments to the AST through go/ast, this will be easy to fix, but I suspect a new ast package will be the real place to fix this. Labels changed: added priority-someday, removed priority-triage. Status changed to Accepted. |
sarahhodne
added a commit
to travis-ci/worker
that referenced
this issue
Jan 19, 2015
There's a bug in Go cover that causes the line numbers to get rewritten (golang/go#6329), so in order to debug runtime panics we'd need a way to run the tests without the coverage tool and get the right line number for where the panic happens.
CL https://golang.org/cl/38640 mentions this issue. |
gopherbot
pushed a commit
that referenced
this issue
May 22, 2017
Due to the fact that -cover injects additional code to the original source, tests run with -cover will often have incorrect line numbers. Also includes docs for -list regexp missed by ba8ff87 Updates #6329 Change-Id: I87f0618ac31e96071bca61055cc17c0cbdee208a Reviewed-on: https://go-review.googlesource.com/38640 Reviewed-by: Rob Pike <r@golang.org>
Change https://golang.org/cl/77151 mentions this issue: |
Change https://golang.org/cl/77150 mentions this issue: |
gopherbot
pushed a commit
that referenced
this issue
Nov 16, 2017
Now that cover does not modify the formatting of the original file or add any newline characters, we can make it print a //line comment pointing back at the original, and compiler errors and panics will report accurate line numbers. Fixes #6329. Fixes #15757. Change-Id: I7b0e386112c69beafe69e0d47c5f9e9abc87c0f5 Reviewed-on: https://go-review.googlesource.com/77151 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: