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

go/scanner: "//line :1" denotes the current directory #7765

Closed
adonovan opened this issue Apr 11, 2014 · 4 comments
Closed

go/scanner: "//line :1" denotes the current directory #7765

adonovan opened this issue Apr 11, 2014 · 4 comments

Comments

@adonovan
Copy link
Member

The scanner's interpretation of a //line directive that lacks a filename, such as this:

//line :1

is very surprising.  I would have expected it to mean either "line 1 of the current
file", or "line 1 of the file specified by the previous //line
directive", but instead it means "line 1 of the directory containing the
current file".  This is obviously nonsensical since directories don't have lines,
but this is actually seems to be the intended behaviour, if
go/scanner/scanner_test.go:497 is to be believed:

497: {"\n//line :1\n  line1", "dir", 1},

I think this is a bug.  I would prefer either of the two interpretations I suggested
over the current one.

(Why do I care?  Because the cgo preprocessor emits files containing "//line
:1" prior to each field of a struct type.  I suspect that is probably unintended
too, but that's another story.)
@gopherbot
Copy link

Comment 1:

CL https://golang.org/cl/86990044 mentions this issue.

@adonovan
Copy link
Member Author

Comment 2:

This issue was closed by revision d079144.

Status changed to Fixed.

@gopherbot
Copy link

Comment 3:

CL https://golang.org/cl/88160050 mentions this issue.

@adonovan
Copy link
Member Author

Comment 4:

This issue was closed by revision 0de521d.

@adonovan adonovan added the fixed label Apr 16, 2014
@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants