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

Comments

Projects
None yet
5 participants
@masiulaniec
Copy link

commented Aug 10, 2014

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

This comment has been minimized.

Copy link
Member

commented Aug 20, 2014

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

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Member

commented Aug 20, 2014

Comment 3:

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

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link

commented Aug 22, 2014

Comment 6:

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

This comment has been minimized.

Copy link
Contributor

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

This issue was closed.

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.