github.com/d4l3k/go@v0.0.0-20151015000803-65fc379daeda/src/cmd/vet/testdata/examples_test.go (about) 1 // Test of examples. 2 3 package testdata 4 5 // Buf is a ... 6 type Buf []byte 7 8 // Append ... 9 func (*Buf) Append([]byte) {} 10 11 func (Buf) Reset() {} 12 13 func (Buf) Len() int { return 0 } 14 15 // DefaultBuf is a ... 16 var DefaultBuf Buf 17 18 func Example() {} // OK because is package-level. 19 20 func Example_goodSuffix() // OK because refers to suffix annotation. 21 22 func Example_BadSuffix() // ERROR "Example_BadSuffix has malformed example suffix: BadSuffix" 23 24 func ExampleBuf() // OK because refers to known top-level type. 25 26 func ExampleBuf_Append() {} // OK because refers to known method. 27 28 func ExampleBuf_Clear() {} // ERROR "ExampleBuf_Clear refers to unknown field or method: Buf.Clear" 29 30 func ExampleBuf_suffix() {} // OK because refers to suffix annotation. 31 32 func ExampleBuf_Append_Bad() {} // ERROR "ExampleBuf_Append_Bad has malformed example suffix: Bad" 33 34 func ExampleBuf_Append_suffix() {} // OK because refers to known method with valid suffix. 35 36 func ExampleDefaultBuf() {} // OK because refers to top-level identifier. 37 38 func ExampleBuf_Reset() bool { return true } // ERROR "ExampleBuf_Reset should return nothing" 39 40 func ExampleBuf_Len(i int) {} // ERROR "ExampleBuf_Len should be niladic" 41 42 // "Puffer" is German for "Buffer". 43 44 func ExamplePuffer() // ERROR "ExamplePuffer refers to unknown identifier: Puffer" 45 46 func ExamplePuffer_Append() // ERROR "ExamplePuffer_Append refers to unknown identifier: Puffer" 47 48 func ExamplePuffer_suffix() // ERROR "ExamplePuffer_suffix refers to unknown identifier: Puffer"