-
Notifications
You must be signed in to change notification settings - Fork 18k
fmt: fix incorrect format of whole-number floats when using %#v #26383
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
Conversation
9092511
to
95c3348
Compare
0090c13
to
8fbbf63
Compare
Message from Gerrit User 5015: Patch Set 1: (3 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/123956. |
Message from Gerrit User 12415: Patch Set 2:
Done! Please don’t reply on this GitHub thread. Visit golang.org/cl/123956. |
Message from Gerrit User 13550: Patch Set 2: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/123956. |
Message from Gerrit User 12446: Uploaded patch set 3: Commit message was updated. Please don’t reply on this GitHub thread. Visit golang.org/cl/123956. |
Message from Gerrit User 13550: Patch Set 5: remember that you need to update the PR title and description to update the commit message. that's #25359 Please don’t reply on this GitHub thread. Visit golang.org/cl/123956. |
Message from Gerrit User 12415: Patch Set 6: Commit message was updated. Please don’t reply on this GitHub thread. Visit golang.org/cl/123956. |
Message from Gerrit User 12415: Patch Set 7: Commit message was updated. Please don’t reply on this GitHub thread. Visit golang.org/cl/123956. |
Message from Gerrit User 12446: Uploaded patch set 8: Commit message was updated. Please don’t reply on this GitHub thread. Visit golang.org/cl/123956. |
Message from Gerrit User 12415: Patch Set 9: Commit message was updated. Please don’t reply on this GitHub thread. Visit golang.org/cl/123956. |
Message from Gerrit User 12446: Uploaded patch set 10: Commit message was updated. Please don’t reply on this GitHub thread. Visit golang.org/cl/123956. |
Message from Gerrit User 12415: Patch Set 11: Commit message was updated. Please don’t reply on this GitHub thread. Visit golang.org/cl/123956. |
Message from Gerrit User 12446: Uploaded patch set 12: Commit message was updated. Please don’t reply on this GitHub thread. Visit golang.org/cl/123956. |
Message from Gerrit User 12446: Uploaded patch set 13: Commit message was updated. Please don’t reply on this GitHub thread. Visit golang.org/cl/123956. |
Message from Gerrit User 12415: Patch Set 13: (5 comments)
OK, I think I got it working. Sorry I haven't used Gerrit in five years. Please don’t reply on this GitHub thread. Visit golang.org/cl/123956. |
Message from Gerrit User 13550: Patch Set 13: Run-TryBot+1 Code-Review+1 Will leave it to Rob to +2. Please don’t reply on this GitHub thread. Visit golang.org/cl/123956. |
Message from Gerrit User 5976: Patch Set 13: TryBots beginning. Status page: https://farmer.golang.org/try?commit=b8b1f160 Please don’t reply on this GitHub thread. Visit golang.org/cl/123956. |
Message from Gerrit User 5976: Patch Set 13: Build is still in progress... Consult https://build.golang.org/ to see whether it's a new failure. Other builds still in progress; subsequent failure notices suppressed until final report. Please don’t reply on this GitHub thread. Visit golang.org/cl/123956. |
Message from Gerrit User 5976: Patch Set 13: TryBot-Result-1 5 of 19 TryBots failed: Consult https://build.golang.org/ to see whether they are new failures. Please don’t reply on this GitHub thread. Visit golang.org/cl/123956. |
Message from Gerrit User 13550: Patch Set 13: it seems like some compiler tests broke, as some compiler error messages got a bit better. please update the tests so that they pass again. Please don’t reply on this GitHub thread. Visit golang.org/cl/123956. |
Message from Gerrit User 12415: Patch Set 13:
It looks like the failures aren't connected to this CL though... Is there a retry button somewhere? Please don’t reply on this GitHub thread. Visit golang.org/cl/123956. |
Message from Gerrit User 13550: Patch Set 13:
Yes, they are connected. The compiler now prints better errors in some cases including floats, so you need to update the tests to change the expected error strings. This is what I meant above. Please don’t reply on this GitHub thread. Visit golang.org/cl/123956. |
Message from Gerrit User 12415: Patch Set 13:
OK cool I'll take a look... Please don’t reply on this GitHub thread. Visit golang.org/cl/123956. |
This fixes the unwanted behaviour where printing a zero float with the that the output would be interpreted as an int rather than a float when parsed as Go source. After this change the the output is "0.0". Fixes golang#26363
Message from Gerrit User 12415: Patch Set 14:
OK it took me a little while to work out exactly what was going on there. Tests pass now, but are we OK with those new error messages? Please don’t reply on this GitHub thread. Visit golang.org/cl/123956. |
Message from Gerrit User 13550: Patch Set 14: Run-TryBot+1 Code-Review+1 The new errors seem fine to me, even if they're a bit verbose. Adding Robert and Matthew for a second opinion. Please don’t reply on this GitHub thread. Visit golang.org/cl/123956. |
Message from Gerrit User 5976: Patch Set 14: TryBots beginning. Status page: https://farmer.golang.org/try?commit=28fd2186 Please don’t reply on this GitHub thread. Visit golang.org/cl/123956. |
Message from Gerrit User 5976: Patch Set 14: TryBot-Result+1 TryBots are happy. Please don’t reply on this GitHub thread. Visit golang.org/cl/123956. |
Message from Gerrit User 5015: Patch Set 14: Code-Review+2 Please don’t reply on this GitHub thread. Visit golang.org/cl/123956. |
This PR is being closed because golang.org/cl/123956 has been merged. |
This fixes the unwanted behaviour where printing a zero float with the #v fmt verb outputs "0" - e.g. missing the trailing decimal. This means that the output would be interpreted as an int rather than a float when parsed as Go source. After this change the the output is "0.0". Fixes #26363 Change-Id: Ic5c060522459cd5ce077675d47c848b22ddc34fa GitHub-Last-Rev: adfb061 GitHub-Pull-Request: #26383 Reviewed-on: https://go-review.googlesource.com/123956 Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Rob Pike <r@golang.org> Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org>
This fixes the unwanted behaviour where printing a zero float with the
#v fmt verb outputs "0" - e.g. missing the trailing decimal. This means
that the output would be interpreted as an int rather than a float when
parsed as Go source. After this change the the output is "0.0".
Fixes #26363