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: failed import causes spurious printf error #17006

Closed
alandonovan opened this issue Sep 6, 2016 · 3 comments
Closed

cmd/vet: failed import causes spurious printf error #17006

alandonovan opened this issue Sep 6, 2016 · 3 comments

Comments

@alandonovan
Copy link
Contributor

$ cat a.go
package main

import "nosuchpkg"

var format = "%s %s"
var _ = nosuchpkg.Sprintf(format, "a", "b")

$ vet ~/a.go
/usr/local/google/home/adonovan/a.go:6: no formatting directive in Sprintf call

The printf check issues a spurious error when type information for an imported printf-like function is not available. Without the function's type signature, the checker heuristically assumes that the first string constant is the format string, such as "a" in the example above.

@quentinmit quentinmit added this to the Go1.8Maybe milestone Sep 6, 2016
@josharian
Copy link
Contributor

cc @valyala

@josharian josharian changed the title vet: failed import causes spurious printf error cmd/vet: failed import causes spurious printf error Sep 7, 2016
@valyala
Copy link
Contributor

valyala commented Sep 10, 2016

Prepared the CL.

@gopherbot
Copy link

CL https://golang.org/cl/29014 mentions this issue.

@golang golang locked and limited conversation to collaborators Oct 5, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants