Go: cmd/vet: update for new number formats

Created on 30 Jan 2019  路  22Comments  路  Source: golang/go

cmd/vet once again lives outside the main tree (sigh).

We need to remember to update the printf checker for
the new formats %#b and %O on integers, %x on float/complex.

NeedsFix release-blocker

Most helpful comment

@ianlancetaylor note that %#b and %x support was added in other changes by other people and these changes would need to be cherry picked as well...

The changes in question are:

All 22 comments

Change https://golang.org/cl/160246 mentions this issue: fmt: format 0b, 0o prefixes in %#b and %O

Change https://golang.org/cl/160245 mentions this issue: fmt: format hex floats and complexes

It looks like _vet_'s update for the new octal format verb 'O' would go here.

Change https://golang.org/cl/235100 mentions this issue: go/analysis/passes/printf: allow %O in format strings

As far as I can tell this bug should be fixed.

@rsc, could you double check and mark this bug as fixed?
https://github.com/golang/tools/blob/8b020aee10d2dc97e13b76ce01b59c9b5d4a4d0f/go/analysis/passes/printf/printf.go#L790-L819

Also as %O was introduced with Go 1.13 should this be included in the next Go 1.13 and 1.14 point releases?

I don't think this is fixed until we import a new version of the packages into the main sources.

@gopherbot 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.

@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.

Backport issue(s) opened: #39287 (for 1.13), #39288 (for 1.14).

Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases.

@ianlancetaylor note that %#b and %x support was added in other changes by other people and these changes would need to be cherry picked as well...

The changes in question are:

@michael-schaller True. At a quick glance it seems like those two are fixed in 1.14, but not in 1.13.

@ianlancetaylor please let me know if I can help in some other way with this bug. I'm curious how this is all handled... ;-)

The version of the golang.org/x/tools module is specified in the src/cmd/go.mod files on the release branches for Go 1.14 and 1.13:

The release branches in golang.org/x/tools should correspond to those pseudo-versions:

This is already the case for 1.14, but the x/tools release-branch.go1.13 is incorrect (it's many commits ahead) and will need to be reset to match the version selected in https://github.com/golang/go/blob/release-branch.go1.13/src/cmd/go.mod#L11.

Then, it's a matter of backporting the relevant vet fixes to each of the x/tools release branches, and updating the go.mod (and re-running go mod vendor as documented here) accordingly on the main Go release branches.

Given it's quite a bit of mechanics, it's likely a good idea to wait until the backport issues (#39288 and #39287) make progress from their current CherryPickCandidate state before starting the work.

The backport issues have been approved.

I'll also add release-blocker to this to track the vendor of CL 235100 into the main tree.

Change https://golang.org/cl/236138 mentions this issue: cmd: update golang.org/x/tools to v0.0.0-20200601175630-2caf76543d99

@dmitshur Sorry, didn't notice that you had assigned this to yourself.

@ianlancetaylor That is not a problem. I noticed you've sent the CL thanks to gopherbot's message above just before I started doing any work. I reviewed your CL. Thank you.

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

Change https://golang.org/cl/236199 mentions this issue: [release-branch.go1.14] cmd: update golang.org/x/tools to v0.0.0-20200602230032-c00d67ef29d0

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

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

Was this page helpful?
0 / 5 - 0 ratings