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: does not report possible formatting directive with %v #22847

Closed
rsc opened this issue Nov 22, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@rsc
Copy link
Contributor

commented Nov 22, 2017

I don't understand why vet reports no problems here:

$ cat x_test.go
package p

import (
	"log"
	"testing"
)

func Test(t *testing.T) {}

func f() {
	log.Fatal("error: %v", 1)
}
$ go test x_test.go
ok  	command-line-arguments	0.012s
$ 

@rsc rsc added this to the Go1.10 milestone Nov 22, 2017

@mvdan

This comment has been minimized.

Copy link
Member

commented Nov 22, 2017

Having a look at this at the moment. Seems unrelated to test files, as this one fails too:

 $ cat f.go
package p

import "log"

func F() {
        log.Fatal("%v", 1)
}
$ go vet f.go
$ go1 vet f.go
f.go:6: possible formatting directive in Fatal call
exit status 1

Note how this seems to be a regression from 1.9, however, as it works fine there.

@mvdan mvdan self-assigned this Nov 22, 2017

@mvdan

This comment has been minimized.

Copy link
Member

commented Nov 22, 2017

It looks like this was a small regression in fc768da - likely an issue in the regex. CL coming soon.

@mvdan mvdan changed the title cmd/vet: does not report log.Fatal with format string cmd/vet: does not report possible formatting directive with %v Nov 22, 2017

@gopherbot

This comment has been minimized.

Copy link

commented Nov 22, 2017

Change https://golang.org/cl/79455 mentions this issue: cmd/vet: add missing %v to the verb regex

@gopherbot gopherbot closed this in 88599f1 Nov 22, 2017

@golang golang locked and limited conversation to collaborators Nov 22, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.