36 lines
273 B
Go
36 lines
273 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"net"
|
|
)
|
|
|
|
type Foo interface {
|
|
Bar()
|
|
}
|
|
|
|
func bar() {
|
|
fmt.Println("bar")
|
|
}
|
|
|
|
func run(f Foo) {
|
|
f.Bar()
|
|
}
|
|
|
|
type t struct {
|
|
Bar func()
|
|
}
|
|
|
|
type t2 struct {
|
|
}
|
|
|
|
func (t t2) Bar() {
|
|
bar()
|
|
}
|
|
|
|
func main() {
|
|
run(t2{})
|
|
var d net.Dialer
|
|
d.Cancel
|
|
}
|