1
0
mirror of https://github.com/golang/go synced 2024-11-06 06:26:13 -07:00
go/refactor/eg/testdata/F1.golden
Paul Nasrat 89156360f9 go.tools/refactor/eg: Support promoted fields and methods.
As per http://golang.org/ref/spec#Struct_types enable eg tool
to wildcard match against promoted fields and methods.

LGTM=adonovan
R=adonovan, gordon.klaus
CC=golang-codereviews
https://golang.org/cl/129260043
2014-08-25 16:26:54 -04:00

49 lines
600 B
Plaintext

// +build ignore
package F1
import "sync"
func example(n int) {
var x struct {
mutex sync.RWMutex
}
var y struct {
sync.RWMutex
}
type l struct {
sync.RWMutex
}
var z struct {
l
}
var a struct {
*l
}
var b struct{ Lock func() }
// Match
x.mutex.RLock()
// Match
y.RLock()
// Match indirect
z.RLock()
// Should be no match however currently matches due to:
// https://code.google.com/p/go/issues/detail?id=8584
// Will start failing when this is fixed then just change golden to
// No match pointer indirect
// a.Lock()
a.RLock()
// No match
b.Lock()
}