Open dlsniper opened 8 years ago
package main
type baseType interface {
Method() string
}
type middleType struct {
baseType
}
func (c *middleType) /*def*/Method() string {
return "Hi!"
}
type leafType struct {
middleType
}
func main() {
var leaf = leafType{}
println(leaf./*ref*/Method())
var middle = middleType{}
println(middle./*ref*/Method())
}
@dlsniper Please provide an isolated sample next time.
Will do. Also, please ping me / label these with Feedback required
when you think I need to provide a better example for issues as sometimes I open issues but I don't have too much time to investigate on my own.
I'm sorry it took a bit but reverse engineering this was fun :) However, here it is:
package main
type PacketCnn interface {
ReadFrom(b []byte) (n int, addr int, err error)
}
type dgramOpt struct {
PacketCnn
}
type payloadHandler struct {
PacketCnn
}
func (c *payloadHandler) /*def*/ReadFrom(b []byte) (a, d, e, f int) {
println("hello")
return 1, 2, 3, 4
}
type ipv4PacketConn struct {
dgramOpt
payloadHandler
}
var a PacketCnn = &PacketConn{p4: &ipv4PacketConn{}}
type PacketConn struct {
c PacketCnn
p4 *ipv4PacketConn
}
func (c *PacketConn) ReadFrom(b []byte) (n int, addr int, err error) {
_, _, _, _ = c.p4./*ref*/ReadFrom(b)
return 1, 1, nil
}
func main() {
_, _, _ = a.ReadFrom([]byte{})
}
I've updated the example a bit to be clear that things actually work (and trim it down as well).
It's all about DFS/BFS.
Using 9b670063971f91221633cbb38008966c07855f79 in the following package
go get -v -u -t golang.org/x/net
, the following line resolves incorrectly to the builtin package https://github.com/golang/net/blob/28273ec927bee3bea305f112fc28ceee575ea893/icmp/endpoint.go#L56it should resolve to
x/net/ipv4/package.go:23
but it resolves to Go sdknet/net.go:306
.