github.com/traefik/yaegi@v0.15.1/_test/interface37.go (about)

     1  package main
     2  
     3  type I interface {
     4  	A() string
     5  	B() string
     6  }
     7  
     8  type s struct{}
     9  
    10  func NewS() (I, error) {
    11  	return &s{}, nil
    12  }
    13  
    14  func (c *s) A() string { return "a" }
    15  func (c *s) B() string { return "b" }
    16  
    17  func main() {
    18  	s, _ := NewS()
    19  	println(s.A())
    20  }
    21  
    22  // Output:
    23  // a