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

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"reflect"
     6  )
     7  
     8  type A struct {
     9  	Test string `tag:"test"`
    10  }
    11  
    12  func main() {
    13  	a := A{}
    14  	t := reflect.TypeOf(a)
    15  	f, ok := t.FieldByName("Test")
    16  	if !ok {
    17  		return
    18  	}
    19  
    20  	fmt.Println(f.Tag.Get("tag"))
    21  }
    22  
    23  // Output:
    24  // test