gitee.com/wgliang/goreporter@v0.0.0-20180902115603-df1b20f7c5d0/linters/golint/testdata/4.go (about) 1 // Test that exported names have correct comments. 2 3 // Package pkg does something. 4 package pkg 5 6 import "time" 7 8 type T int // MATCH /exported type T.*should.*comment.*or.*unexport/ 9 10 func (T) F() {} // MATCH /exported method T\.F.*should.*comment.*or.*unexport/ 11 12 // this is a nice type. 13 // MATCH /comment.*exported type U.*should.*form.*"U ..."/ 14 type U string 15 16 // this is a neat function. 17 // MATCH /comment.*exported method U\.G.*should.*form.*"G ..."/ 18 func (U) G() {} 19 20 // A V is a string. 21 type V string 22 23 // V.H has a pointer receiver 24 25 func (*V) H() {} // MATCH /exported method V\.H.*should.*comment.*or.*unexport/ 26 27 var W = "foo" // MATCH /exported var W.*should.*comment.*or.*unexport/ 28 29 const X = "bar" // MATCH /exported const X.*should.*comment.*or.*unexport/ 30 31 var Y, Z int // MATCH /exported var Z.*own declaration/ 32 33 // Location should be okay, since the other var name is an underscore. 34 var Location, _ = time.LoadLocation("Europe/Istanbul") // not Constantinople 35 36 // this is improperly documented 37 // MATCH /comment.*const.*Thing.*form.*"Thing ..."/ 38 const Thing = "wonderful"