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

cmd/vet: update for new number formats [1.13 backport] #39287

Closed
gopherbot opened this issue May 27, 2020 · 11 comments
Closed

cmd/vet: update for new number formats [1.13 backport] #39287

gopherbot opened this issue May 27, 2020 · 11 comments
Assignees
Milestone

Comments

@gopherbot
Copy link

@gopherbot gopherbot commented May 27, 2020

@ianlancetaylor requested issue #29986 to be considered for backport to the next 1.13 minor release.

@gopherbot Please open backport issues for 1.13 and 1.14

"go vet" should permit %O in fmt.Printf formats, as the formatting code was added in the 1.13 release.

@dmitshur
Copy link
Member

@dmitshur dmitshur commented Jun 2, 2020

Approving for 1.14 (#39288) and 1.13 (this issue). This is a serious problem affecting valid Go code with no workaround.

@dmitshur
Copy link
Member

@dmitshur dmitshur commented Jun 2, 2020

I've described the mechanics to perform this backport in full detail in #29986 (comment).

For the 1.13 backport, we need to:

  • first, reset the release-branch.go1.13 branch in x/tools to the correct revision, then
  • backport CL 202041 into release-branch.go1.13 in x/tools,
  • backport CL 203798 into release-branch.go1.13 in x/tools,
  • backport CL 235100 into release-branch.go1.13 in x/tools,
  • finally, re-vendor the latest x/tools release-branch.go1.13 branch in the cmd module.
@dmitshur dmitshur self-assigned this Jun 11, 2020
@gopherbot
Copy link
Author

@gopherbot gopherbot commented Jun 15, 2020

Change https://golang.org/cl/237942 mentions this issue: [release-branch.go1.13] go/analysis/passes/printf: allow %x/%X for float/complex types

@gopherbot
Copy link
Author

@gopherbot gopherbot commented Jun 15, 2020

Change https://golang.org/cl/237945 mentions this issue: [release-branch.go1.13] go/analysis/passes/printf: allow %O in format strings

@gopherbot
Copy link
Author

@gopherbot gopherbot commented Jun 15, 2020

Change https://golang.org/cl/237944 mentions this issue: [release-branch.go1.13] go/analysis/passes/printf: allow # for b flag

@gopherbot
Copy link
Author

@gopherbot gopherbot commented Jun 15, 2020

Closed by merging 03eb5928a63b2227d996a7cc2ef45de5f335189e to release-branch.go1.13.

@gopherbot gopherbot closed this Jun 15, 2020
gopherbot pushed a commit to golang/tools that referenced this issue Jun 15, 2020
…oat/complex types

These verbs are supported as of Go 1.13.

Updates golang/go#34993.
For golang/go#39287.

Change-Id: Ib7892e45b51073e3771bebb652a8fe3a1c6ae3c6
Reviewed-on: https://go-review.googlesource.com/c/tools/+/202041
Run-TryBot: Caleb Spare <cespare@gmail.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
(cherry picked from commit 04252ec)
Reviewed-on: https://go-review.googlesource.com/c/tools/+/237942
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
gopherbot pushed a commit to golang/tools that referenced this issue Jun 15, 2020
Adding the `#` to a `b` flag is allowed and adds a leading `0b` to the output.

For golang/go#39287.

Change-Id: I421891f9478d1aaff2585455f38b3aa50e8277ab
GitHub-Last-Rev: 016896a
GitHub-Pull-Request: #182
Reviewed-on: https://go-review.googlesource.com/c/tools/+/203798
Reviewed-by: Erik Dubbelboer <erik@dubbelboer.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/tools/+/237944
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
gopherbot pushed a commit to golang/tools that referenced this issue Jun 15, 2020
… strings

%O is supported since Go 1.13. See golang.org/design/19308-number-literals for
the background.

Support for %O has been added by copying and adapting the %o implementation.

Updates golang/go#29986.
For golang/go#39287.

Change-Id: Ic49d3cc8d9aefcc0ecbfcfe5ebf206e6f951d413
Reviewed-on: https://go-review.googlesource.com/c/tools/+/235100
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/tools/+/237945
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
@dmitshur
Copy link
Member

@dmitshur dmitshur commented Jun 15, 2020

Reopening for re-vendor (the last step of #39287 (comment)).

@dmitshur dmitshur reopened this Jun 15, 2020
@gopherbot
Copy link
Author

@gopherbot gopherbot commented Jun 15, 2020

Closed by merging 991d59a616deaaf84d86e0819e386431a7a31b87 to release-branch.go1.13.

@gopherbot gopherbot closed this Jun 15, 2020
@gopherbot
Copy link
Author

@gopherbot gopherbot commented Jun 15, 2020

Closed by merging f7130111797081f96423344c9f062b15df555902 to release-branch.go1.13.

@dmitshur dmitshur reopened this Jun 15, 2020
@gopherbot
Copy link
Author

@gopherbot gopherbot commented Jun 15, 2020

Change https://golang.org/cl/238018 mentions this issue: [release-branch.go1.13] cmd: update golang.org/x/tools to v0.0.0-20200615191743-991d59a616de

gopherbot pushed a commit that referenced this issue Jun 15, 2020
…0615191743-991d59a616de

This teaches vet to recognize the new formats %#b and %O on integers,
%x on float/complex. They have been supported since the 1.13 release,
but vet would warn about it.

Also update cmd/vet testdata accordingly, as was done in CL 202083.

Fixes #39287.
For #29986.

Change-Id: Ia7817ee60ae6beac32cc402c0c68afa917e4ef0f
Reviewed-on: https://go-review.googlesource.com/c/go/+/238018
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
@dmitshur
Copy link
Member

@dmitshur dmitshur commented Jun 15, 2020

Fixed by merging 206ee87 to release-branch.go1.13.

@dmitshur dmitshur closed this Jun 15, 2020
@andybons andybons removed this from the Go1.13.13 milestone Jul 14, 2020
@andybons andybons added this to the Go1.13.14 milestone Jul 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.