1
0
mirror of https://github.com/golang/go synced 2024-11-08 12:06:18 -07:00
go/src/cmd/vet
Russ Cox 0f89efa255 cmd/vet: report uncalled functions in Printf %v
Given, say, var f *os.File, a new vet check in CL 14122 diagnoses:

	fmt.Printf("%s\n", f.Name)
	fmt.Println(f.Name)

but not

	fmt.Printf("%v\n", f.Name)

In all three cases the error is that the argument should be f.Name().

Diagnosing Println but not Printf %v seems oddly inconsistent,
so I changed %v to have the check too. In fact, all verbs now have
the check except %p and %T.

Fixes Dave Cheney's confusion when trying to write an example
of the new vet check advertised in the Go 1.6 release notes.

Change-Id: I92fa6a7a1d5d9339a6a59ae4e587a254e633f500
Reviewed-on: https://go-review.googlesource.com/19101
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-01-29 17:01:47 +00:00
..
internal/whitelist cmd/vet: move cmd/vet/whitelist to cmd/vet/internal/whitelist 2015-12-05 06:26:17 +00:00
testdata cmd/vet: report uncalled functions in Printf %v 2016-01-29 17:01:47 +00:00
asmdecl.go cmd/vet: power64 is now ppc64 2015-08-18 17:00:59 +00:00
assign.go
atomic.go
bool.go
buildtag.go
cgo.go cmd/vet: add some checks for invalid pointer passing using cgo 2015-12-18 00:31:21 +00:00
composite.go cmd/vet: move cmd/vet/whitelist to cmd/vet/internal/whitelist 2015-12-05 06:26:17 +00:00
copylock.go cmd/vet: diagnose plain assignment in copylock detector 2015-09-10 16:55:51 +00:00
deadcode.go
doc.go cmd/vet: add some checks for invalid pointer passing using cgo 2015-12-18 00:31:21 +00:00
example.go cmd/vet: copy changes from golang.org/x/tools to cmd/vet 2015-09-21 17:48:38 +00:00
main.go cmd/vet: make "-all -shadow" mean all default checks and -shadow 2015-12-05 04:07:36 +00:00
method.go
nilfunc.go
print.go cmd/vet: report uncalled functions in Printf %v 2016-01-29 17:01:47 +00:00
rangeloop.go
shadow.go cmd/vet: fix shadow assignment check with complex rhs 2015-10-21 14:27:49 +00:00
shift.go
structtag.go
types.go
unsafeptr.go
unused.go
vet_test.go cmd/vet: use testenv 2015-11-04 15:59:10 +00:00