package main type IBar interface { doSomething() } type Foo int func (f Foo) doSomething() { println(f) } func test(b IBar) { b.doSomething() } func main() { f := Foo(1) test(f) }
1
test.go:20: cannot use f (type Foo) as type IBar in function argument: Foo does not implement IBar (missing doSomething method)