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/compile: what exactly should -L flag do? #36988
Comments
thanks for looking at this... it's significant because IDEs like VSCode cannot click through to the filename listed in the terminal if it is not rooted in the workspace. |
should be an easy one i would think. |
Thank you for the report @jkassis and welcome to the Go project! |
I tried this back to 1.10 and as far as I can tell, |
@aclements Will investigate. |
Note that CL 77090 explicitly states that package main
var _ = int
//line foo.go:42
var x = y
func /*line bar.go:7:1*/ init(int){} (full path
Thus, It shouldn't be difficult to make |
Since We have a variety of options for reporting error positions: file paths can be relative (to cwd) or absolute. And positions can be relative to the most recent We can abbreviate these 4 possible combinations with 4 letters: Currently, without the
With the
where the There are many possible combinations ( I suspect (from the original comment in this issue) that the expectation for
if there's no
if
if there's no
if Comments? |
This issue is currently labeled as early-in-cycle for Go 1.17. |
Pushing to Go1.18 milestone. |
This issue is currently labeled as early-in-cycle for Go 1.18. |
Not going to happen for 1.18; we have more urgent issues. |
This issue is currently labeled as early-in-cycle for Go 1.19. |
I don't have a strong opinion. For errors integrated into the editing session (e.g. |
Change https://go.dev/cl/395115 mentions this issue: |
Thanks - I didn't know about this issue and didn't think about the complication caused by the I recall this was an issue in the The plan back then was to implement But I am not too familiar with this code base :-) so I may be wrong. (*) WIth |
@hyangah The pending CL https://go.dev/cl/395115 simply changes the flag's help message. Note that As is, the If that's ok, please approve the CL above. |
@griesemer Thanks - I didn't look at the change yet - and assumed you were planning on a bigger change as described in the last comment #36988 (comment). If it's only documentation change to clarify the current behavior and there is no behavioral change, that sounds good to me. The original report is about the surprising result from |
The file names reported in error messages by the compiler are printed unchanged from the file names provided to the compiler; the -L flag has no impact on the file names themselves, contrary to what the old flag description suggested. If an error is reported on a line that is affected by a //line directive, an error message reports the file name and line as controlled by the directive (i.e., the actual source position is not known). If the -L flag is provided, the actual source position is also reported in square brackets. This change documents this with an updated help string for the flag. For #36988. Change-Id: I39ee35e6ff6cd5cfa44d87dabb05b8d78575d631 Reviewed-on: https://go-review.googlesource.com/c/go/+/395115 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Thanks, @hyangah, for the feedback. Indeed, originally I was considering a more substantial change, and perhaps that is still the right call. The @jkassis This issue has been open for a while. Is there still something to do here? As far as I can tell, VSCode doesn't have a problem locating a file given an error position. When there is a //line directive and the
and with
I think there's one reasonable alternative implementation, which is what I had outlined in #36988 (comment):
(see the comment mentioned above for an example). Leaving this open for now. |
Timed out in state WaitingForInfo. Closing. (I am just a bot, though. Please speak up if this is a mistake or you have the requested information.) |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?macos 10.15.2
go env
OutputWhat did you do?
What did you expect to see?
full paths in the errors list
What did you see instead?
partial paths
The text was updated successfully, but these errors were encountered: