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

Comments

Projects
None yet
5 participants
@alandonovan
Copy link
Contributor

commented Sep 6, 2016

$ 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

This comment has been minimized.

Copy link
Contributor

commented Sep 7, 2016

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

@valyala

This comment has been minimized.

Copy link
Contributor

commented Sep 10, 2016

Prepared the CL.

@gopherbot

This comment has been minimized.

Copy link

commented Sep 10, 2016

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

@gopherbot gopherbot closed this in ee8ec42 Oct 5, 2016

@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.
You can’t perform that action at this time.