github.com/azazeal/revive@v1.0.9/testdata/confusing-naming1.go (about)

     1  // Test of confusing-naming rule.
     2  
     3  // Package pkg ...
     4  package pkg
     5  
     6  type foo struct{}
     7  
     8  func (t foo) aFoo() {
     9  	return
    10  }
    11  
    12  func (t *foo) AFoo() { // MATCH /Method 'AFoo' differs only by capitalization to method 'aFoo' in the same source file/
    13  	return
    14  }
    15  
    16  type bar struct{}
    17  
    18  func (t *bar) aBar() {
    19  	return
    20  }
    21  
    22  func (t *bar) aFoo() { // Should not warn
    23  	return
    24  }
    25  
    26  func aGlobal() {
    27  
    28  }
    29  
    30  func AGlobal() { // MATCH /Method 'AGlobal' differs only by capitalization to function 'aGlobal' in the same source file/
    31  }
    32  
    33  func ABar() { // Should not warn
    34  
    35  }
    36  
    37  func aFoo() { // Should not warn
    38  
    39  }
    40  
    41  func (t foo) ABar() { // Should not warn
    42  	return
    43  }
    44  
    45  func (t bar) ABar() { // MATCH /Method 'ABar' differs only by capitalization to method 'aBar' in the same source file/
    46  	return
    47  }
    48  
    49  func x() {}
    50  
    51  type tFoo struct {
    52  	asd      string
    53  	aSd      int  // MATCH /Field 'aSd' differs only by capitalization to other field in the struct type tFoo/
    54  	qwe, asD bool // MATCH /Field 'asD' differs only by capitalization to other field in the struct type tFoo/
    55  	zxc      float32
    56  }
    57  
    58  type tBar struct {
    59  	asd string
    60  	qwe bool
    61  	zxc float32
    62  }