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: error when using unregistered errorf method #22715

Closed
rogpeppe opened this issue Nov 14, 2017 · 3 comments
Closed

cmd/vet: error when using unregistered errorf method #22715

rogpeppe opened this issue Nov 14, 2017 · 3 comments

Comments

@rogpeppe
Copy link
Contributor

go version devel +fa1f52c Tue Nov 14 05:39:45 2017 +0000 linux/amd64

An example from our code base; we have an errorf method defined:

func (i *idM) errorf(w http.ResponseWriter, status int, format string, a ...interface{})

and some code is calling it:

i.errorf(w, http.StatusNotFound, "not found", "%s not found", req.URL.Path)

This produces an error from vet: errorf call has arguments but no formatting directives.
The vet -printfuncs flag seems to have lost the argument position of the first argument involved in the print, and anyway it would be better not to have to individually configure printf-like functions to get Go code to compile.

This is now a more pressing issue since tip changed to always run vet.

@rogpeppe
Copy link
Contributor Author

At least until the vet checks become 100% reliable, it would be good to have the option to turn off the vet checking done by "go install", so that we can continue to use Go tip on packages like the above that trigger spurious vet errors.

@ianlancetaylor
Copy link
Contributor

I don't think that go install runs any vet checks. The change is that vet checks are now run by go test. You can disable them by using go test -vet=off.

The intent is to not run all vet tests, but only those that are very likely to report errors. #18085 is about pinning down that exact set. I think that perhaps we should move this problem over to that issue and close this one as a dup.

@rogpeppe
Copy link
Contributor Author

Ah, yes, I hadn't realised I just saw the issues running go test. I wasn't sure if this justified another card or not. Perhaps not. I'll close it.

@golang golang locked and limited conversation to collaborators Nov 14, 2018
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

3 participants