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: add logf to the printf check #8504

Closed
masiulaniec opened this issue Aug 10, 2014 · 7 comments
Closed

cmd/vet: add logf to the printf check #8504

masiulaniec opened this issue Aug 10, 2014 · 7 comments

Comments

@masiulaniec
Copy link

I'd like to suggest adding Logf to the standard list:

    Print Printf Println
    Fprint Fprintf Fprintln
    Sprint Sprintf Sprintln
    Error Errorf
    Fatal Fatalf
    Panic Panicf Panicln

It seems common enough, but I can also understand if this is considered bloaty.
@dsymonds
Copy link
Contributor

Comment 1:

Vet has a -printfuncs flag to control the full list of names that it'll check. There's
no end of function names that could be checked. Up to Rob.

Labels changed: added repo-tools.

Owner changed to @robpike.

@cznic
Copy link
Contributor

cznic commented Aug 20, 2014

Comment 2:

Is it just me?
$ go vet
$ go vet -printfuncs=Log:0,Logf:0
flag provided but not defined: -printfuncs
usage: vet [-n] [-x] [packages]
Vet runs the Go vet command on the packages named by the import paths.
For more about vet, see 'godoc code.google.com/p/go.tools/cmd/vet'.
For more about specifying packages, see 'go help packages'.
To run the vet tool with specific options, run 'go tool vet'.
The -n flag prints commands that would be executed.
The -x flag prints commands as they are executed.
See also: go fmt, go fix.
$ go version
go version go1.3.1 linux/amd64
$

@dsymonds
Copy link
Contributor

Comment 3:

Try `go tool vet -printfuncs=...`

@cznic
Copy link
Contributor

cznic commented Aug 20, 2014

Comment 4:

Thanks, it works. Ever only used 'go vet' before. It's a bit unfortunate the dualism
even exists.

@robpike
Copy link
Contributor

robpike commented Aug 22, 2014

Comment 5:

Logf is:
- defined by a key package (testing) in the standard library
- rarely run
Therefore having vet check it makes a lot of sense. I'll add it to the default list.

@gopherbot
Copy link

Comment 6:

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

@robpike
Copy link
Contributor

robpike commented Aug 25, 2014

Comment 7:

This issue was closed by revision golang/tools@cd9959d.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
@rsc rsc unassigned robpike Jun 23, 2022
This issue was closed.
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