Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/go: do not update 'go.mod' automatically if the changes are only cosmetic #34822
#29452, #33779, and #31870 all describe issues due to cosmetic changes in the
It is possible that future changes to the
It is annoying and sometimes intrusive for the
Would it be a reasonable analogy to say this is like running the
The analogy above doesn't work: compiler doesn't change the code in case of compilation errors even if they are obvious; go build doesn't reformat the code: one has to run a dedicated command for that explicitly.
IMHO it is hard to integrate with tools behaving like this. Every client will have to check and handle go.mod changes and roll them back if they are undesired. The go.mod file might not be under my control. If I want to list modules I will have to revert changes in go.mod again and again. I understand the intention of this behavior: to keep go.mod in a good shape and to add mandatory entries there, it is totally reasonable to have this behavior by default, but it would be great to have a mode with this logic disabled.
The previous behavior put the new 'go' directive at the end of the file, which is not where anybody actually puts it, and that in turn complicates the regression tests for golang/go#34822. Updates golang/go#34822 Change-Id: Ic275eb6999fc0db7e72e2d9636b77c9e3d919539 Reviewed-on: https://go-review.googlesource.com/c/mod/+/205497 Run-TryBot: Bryan C. Mills <email@example.com> TryBot-Result: Gobot Gobot <firstname.lastname@example.org> Reviewed-by: Jay Conrod <email@example.com>