github.com/golangci/go-tools@v0.0.0-20190318060251-af6baa5dc196/stylecheck/testdata/src/CheckNames/CheckNames.go (about) 1 // Package pkg_foo ... 2 package pkg_foo // MATCH "should not use underscores in package names" 3 4 var range_ int 5 var _abcdef int 6 var abcdef_ int 7 var abc_def int // MATCH "should not use underscores in Go names; var abc_def should be abcDef" 8 var abc_def_ int // MATCH "should not use underscores in Go names; var abc_def_ should be abcDef_" 9 10 func fn_1() {} // MATCH "func fn_1 should be fn1" 11 func fn2() {} 12 func fn_Id() {} // MATCH "func fn_Id should be fnID" 13 func fnId() {} // MATCH "func fnId should be fnID" 14 15 var FOO_BAR int // MATCH "should not use ALL_CAPS in Go names; use CamelCase instead" 16 var Foo_BAR int // MATCH "var Foo_BAR should be FooBAR" 17 var foo_bar int // MATCH "foo_bar should be fooBar" 18 var kFoobar int // not a check we inherited from golint. more false positives than true ones. 19 20 func fn(x []int) { 21 var ( 22 a_b = 1 // MATCH "var a_b should be aB" 23 c_d int // MATCH "var c_d should be cD" 24 ) 25 a_b += 2 26 for e_f := range x { // MATCH "range var e_f should be eF" 27 _ = e_f 28 } 29 30 _ = a_b 31 _ = c_d 32 } 33 34 //export fn_3 35 func fn_3() {} 36 37 //export not actually the export keyword 38 func fn_4() {} // MATCH "func fn_4 should be fn4" 39 40 //export 41 func fn_5() {} // MATCH "func fn_5 should be fn5" 42 43 // export fn_6 44 func fn_6() {} // MATCH "func fn_6 should be fn6" 45 46 //export fn_8 47 func fn_7() {} // MATCH "func fn_7 should be fn7" 48 49 //go:linkname fn_8 time.Now 50 func fn_8() {}