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

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"net/http"
     6  )
     7  
     8  type A http.Header
     9  
    10  func (a A) Test1() {
    11  	fmt.Println("test1")
    12  }
    13  
    14  type B A
    15  
    16  func (b B) Test2() {
    17  	fmt.Println("test2")
    18  }
    19  
    20  func (b B) Test3() {
    21  	for k, vals := range b {
    22  		for _, v := range vals {
    23  			fmt.Println(k, v)
    24  		}
    25  	}
    26  }
    27  
    28  func main() {
    29  	b := B{}
    30  
    31  	b.Test2()
    32  	b["test"] = []string{"a", "b"}
    33  	b.Test3()
    34  }
    35  
    36  // Output:
    37  // test2
    38  // test a
    39  // test b