Only structures with one embedded field can be marked anonymous, due to golang/go#15924. Also check only that the method is defined, do not verify its complete signature, as the receiver may or not be defined in the arguments of the method. Fixes #1537.
33 lines
363 B
Go
33 lines
363 B
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"io"
|
|
)
|
|
|
|
type TMemoryBuffer struct {
|
|
*bytes.Buffer
|
|
size int
|
|
}
|
|
|
|
func newTMemoryBuffer() *TMemoryBuffer {
|
|
return &TMemoryBuffer{}
|
|
}
|
|
|
|
var globalMemoryBuffer = newTMemoryBuffer()
|
|
|
|
type TTransport interface {
|
|
io.ReadWriter
|
|
}
|
|
|
|
func check(t TTransport) {
|
|
println("ok")
|
|
}
|
|
|
|
func main() {
|
|
check(globalMemoryBuffer)
|
|
}
|
|
|
|
// Output:
|
|
// ok
|