github.com/april1989/origin-go-tools@v0.0.32/refactor/eg/testdata/F1.golden (about)

     1  // +build ignore
     2  
     3  package F1
     4  
     5  import "sync"
     6  
     7  func example(n int) {
     8  	var x struct {
     9  		mutex sync.RWMutex
    10  	}
    11  
    12  	var y struct {
    13  		sync.RWMutex
    14  	}
    15  
    16  	type l struct {
    17  		sync.RWMutex
    18  	}
    19  
    20  	var z struct {
    21  		l
    22  	}
    23  
    24  	var a struct {
    25  		*l
    26  	}
    27  
    28  	var b struct{ Lock func() }
    29  
    30  	// Match
    31  	x.mutex.RLock()
    32  
    33  	// Match
    34  	y.RLock()
    35  
    36  	// Match indirect
    37  	z.RLock()
    38  
    39  	// Should be no match however currently matches due to:
    40  	// https://golang.org/issue/8584
    41  	// Will start failing when this is fixed then just change golden to
    42  	// No match pointer indirect
    43  	// a.Lock()
    44  	a.RLock()
    45  
    46  	// No match
    47  	b.Lock()
    48  }