Files
moxa/_test/interface39.go
Marc Vertes 8605c238ef fix: use interface wrappers to expose interface values to runtime (#643)
* 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
2020-05-20 21:46:14 +02:00

20 lines
227 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