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
x/mod/modfile: parser includes newlines in comment text #39913
Comments
CC @jayconrod |
It looks like this is a regression in This doesn't seem like a Windows-specific issue, though it might have been in |
This means the source locations and lengths for comments will be the same on Windows and Unix-like platforms. Note this works around golang/go#39913
Change https://golang.org/cl/240557 mentions this issue: |
Thanks @jayconrod! |
NB. this is probably the wrong issue tracker;
github.com/golang/mod
describes itself as a[mirror]
but doesn't say what it's mirroring or where to contact the real maintainers, and googling doesn't reveal any obvious primary repo, so if that's the case please let me know where to refile and/or add a note to the mirror repo's descriptionWhat version of Go are you using (
go version
)?1.14
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?Don't currently have access to that box, but a generic Win32 Github Actions VM
What did you do?
Parse a go.mod file including comments using
golang.org/x/mod/modfile
What did you expect to see?
Comments should not include newline characters
What did you see instead?
On Win32, the
\r
of the CRLF line-ending is included in the comment'sToken
field.\r
characters are mostly skipped (https://github.com/golang/mod/blob/master/modfile/read.go#L504) but the code to specifically find the end of a comment (https://github.com/golang/mod/blob/master/modfile/read.go#L522) does not account for a CRLF line-ending. That could be a deliberate choice (the documentation makes no claim either way), but it doesn't seem likely.The text was updated successfully, but these errors were encountered: