-
Notifications
You must be signed in to change notification settings - Fork 18k
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/go: newlines inconsistently preserved in go.mod rewriting #33779
Comments
Note that |
go get
but removed after go build
go get
but removed after go build
I'm willing to fix this issue. I'll check it out and ping here if I need help 😄 |
@zx2c4 I'm not able to reproduce the issue. I get an error instead. I'm not using the beta version though, I'm using the latest master branch commit 66ff373
This is the go.mod file
on executing:
|
|
Thanks @zx2c4 😄 I'm able to reproduce the issue! |
I haven't proceeded much with this issue. Me and my friend @aswinkarthik worked on this. We tried to debug it, but couldn't do much. If someone would help us on how to debug golang code using a debugger , it would be great. We use Intellij IDEA and VSCode too. We'll try more from our side too. The one we noticed was, the new line comes due to the rearranging of the new line that was put by the user. We didn't know where to get rid of it and how it came as manually putting println and compiling and running didn't help much with debugging |
Change https://golang.org/cl/199917 mentions this issue: |
Actually what's happening here is that the module list is being sorted, but the empty line above them in the original file is considered to be a "comment" line, which has an association with the non-comment line below it, and this association is preserved. It probably doesn't make sense to persist blank comment lines during sorting. I'll fix this up. |
go get
but removed after go build
@gopherbot please backport this to 1.13, because it's a regression from the 1. 12, and it causes dirty files in version control and disturbs other automated systems that don't appreciate stable file contents flopping around. |
Backport issue(s) opened: #34800 (for 1.13). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases. |
Change https://golang.org/cl/200118 mentions this issue: |
I'm seeing this in 1.13beta1.
Phase 1: Make a go.mod file:
Phase 2: Resolve everything in it using
go get
:Phase 3: Build it:
Notice how between Phase 2 and Phase 3, a new line after
require (
is added and then removed?Phase 2:
Phase 3:
The text was updated successfully, but these errors were encountered: