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

Preserve line numbers with compiler directives #35

Open
FiloSottile opened this issue May 18, 2015 · 1 comment
Open

Preserve line numbers with compiler directives #35

FiloSottile opened this issue May 18, 2015 · 1 comment

Comments

@FiloSottile
Copy link
Contributor

It's possible to annotate lines so that they are treated as different line numbers in stack traces (panics, ...) and logs (test output, ...)

https://golang.org/cmd/gc/

@jeremyschlatter
Copy link
Contributor

In some cases it will also be possible to preserve the original line number by putting new statements on the same line, e.g.

godebug.Line(ctx, example_in_go_scope, 6); x := mul(1, 2)

vs

godebug.Line(ctx, example_in_go_scope, 6)
//line example-in.go:6
x := mul(1,2)

Given the two snippets above, I think the second one looks better. It is also probably simpler to implement than to implement a mix of line comments and multiple statements on the same line. But it's worth noting the first one as an option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants