* fix: use interface wrappers to expose interface values to runtime If a value is assigned to, or returned as, a binary interface, then use the interface wrapper generator to convert the value accordingly. Fixes #630. * test: rename NewFoo in Foo * test: rename NewFoo in Foo * fix: improve branch flow to reduce indentation
20 lines
225 B
Go
20 lines
225 B
Go
package main
|
|
|
|
import "fmt"
|
|
|
|
type foo struct {
|
|
bar string
|
|
}
|
|
|
|
func (f foo) String() string {
|
|
return "Hello from " + f.bar
|
|
}
|
|
|
|
func main() {
|
|
var f fmt.Stringer = foo{bar: "bar"}
|
|
fmt.Println(f)
|
|
}
|
|
|
|
// Output:
|
|
// Hello from bar
|