github.com/serversong/goreporter@v0.0.0-20200325104552-3cfaf44fd178/linters/golint/testdata/receiver-names.go (about) 1 // Test for bad receiver names. 2 3 // Package foo ... 4 package foo 5 6 type foo struct{} 7 8 func (this foo) f1() { // MATCH /should be a reflection of its identity/ 9 } 10 11 func (self foo) f2() { // MATCH /should be a reflection of its identity/ 12 } 13 14 func (f foo) f3() { 15 } 16 17 func (foo) f4() { 18 } 19 20 type bar struct{} 21 22 func (b bar) f1() { 23 } 24 25 func (b bar) f2() { 26 } 27 28 func (a bar) f3() { // MATCH /receiver name a should be consistent with previous receiver name b for bar/ 29 } 30 31 func (a *bar) f4() { // MATCH /receiver name a should be consistent with previous receiver name b for bar/ 32 } 33 34 func (b *bar) f5() { 35 } 36 37 func (bar) f6() { 38 } 39 40 func (_ *bar) f7() { // MATCH /receiver name should not be an underscore/ 41 } 42 43 type multiError struct{} 44 45 func (me multiError) f8() { 46 } 47 48 // Regression test for a panic caused by ill-formed receiver type. 49 func (recv []*x.y) f()