1
0
mirror of https://github.com/golang/go synced 2024-09-30 22:48:32 -06:00
go/cmd/vet/testdata
Matt T. Proud a25a8d567b tools/cmd/vet: Create vet checks for examples.
In spite of https://blog.golang.org/examples and
http://golang.org/pkg/testing/#pkg-examples, a number of internal Go
authors have found writing documentation examples to be problematic in
the sense that the syntax is error-prone due to loose coupling with
identifiers found in the source corpus.

This commit introduces a suite of validations for documentation
examples:

    Overall:
    - Correct suffices, if present
    - Niladic function argument and return signatures

    func Example() {}
    func ExampleF() {}
    - F exists
    func ExampleT() {}
    - T exists
    func ExampleT_M() {}
    - T exists
    - M exists within T

Further, if the example is in `package foo_test`, vet attempts to
resolve the respective lookups in `package foo`, if `package foo`
exists (cf., `package stringutil_test`).

Change-Id: Ifa13906363541ebf28325681b749b14b7f8b103d
Reviewed-on: https://go-review.googlesource.com/11982
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-15 07:54:34 +00:00
..
divergent tools/cmd/vet: Create vet checks for examples. 2015-09-15 07:54:34 +00:00
incomplete tools/cmd/vet: Create vet checks for examples. 2015-09-15 07:54:34 +00:00
tagtest cmd/vet: add -tags flag 2015-06-04 19:20:34 +00:00
asm1.s cmd/vet: tests for RET checking, SP checking, and leaf functions 2014-11-03 17:27:41 -05:00
asm2.s cmd/vet: tests for RET checking, SP checking, and leaf functions 2014-11-03 17:27:41 -05:00
asm3.s cmd/vet: tests for RET checking, SP checking, and leaf functions 2014-11-03 17:27:41 -05:00
asm4.s go.tools/cmd/vet: handle symbolic TEXT annotations 2013-11-01 11:49:11 -07:00
asm.go cmd/vet: tests for RET checking, SP checking, and leaf functions 2014-11-03 17:27:41 -05:00
assign.go go.tools/cmd/vet: use "go test" to test 2013-05-22 10:20:50 -07:00
atomic.go go.tools/cmd/vet: fix a panic on invalid AddInt 2014-05-14 12:16:58 -07:00
bool.go go.tools/cmd/vet: detect stupid boolean conditions 2014-07-02 10:39:57 -07:00
buildtag_bad.go go.tools/cmd/vet: improve error message for build tag problems 2013-12-18 16:06:56 -08:00
buildtag.go go.tools/cmd/vet: improve error message for build tag problems 2013-12-18 16:06:56 -08:00
composite.go go.tools/cmd/vet: the composite test is about keys, not tags 2013-08-03 12:19:59 +10:00
copylock_func.go go.tools/cmd/vet: warn about copying locks in range statements 2014-09-24 12:35:15 -07:00
copylock_range.go go.tools/cmd/vet: warn about copying locks in range statements 2014-09-24 12:35:15 -07:00
deadcode.go go.tools/cmd/vet: prevent panic on goto without label 2014-06-20 11:08:45 -07:00
examples_test.go tools/cmd/vet: Create vet checks for examples. 2015-09-15 07:54:34 +00:00
method.go go.tools/cmd/vet: use "go test" to test 2013-05-22 10:20:50 -07:00
nilfunc.go go.tools/cmd/vet: fix build of testdata package 2013-08-21 11:08:25 +10:00
print.go cmd/vet: -unusedresult: report calls of pure functions in expression statements 2015-04-06 21:44:23 +00:00
rangeloop.go go.tools/cmd/vet: change message for range check 2014-08-24 17:26:18 -07:00
shadow.go go.tools/cmd/vet: don't check for shadowing of blank identifier 2014-03-13 10:27:55 +11:00
shift.go go.tools/cmd/vet: detect suspicious shifts 2014-08-29 11:17:01 -07:00
structtag.go cmd/vet: allow spaces in struct tag values. 2015-02-06 02:26:15 +00:00
unsafeptr.go cmd/vet: diagnose use of unsafe.Pointer to convert integer to pointer 2014-05-15 15:32:51 -04:00
unused.go cmd/vet: -unusedresult: report calls of pure functions in expression statements 2015-04-06 21:44:23 +00:00