Standard library / go/ast

go/ast.FieldFilter

Function type deciding whether a struct field appears in Fprint output. Expected stdout: 'true false\n'.

Formal Syntax & Structure

go syntaxgo
type FieldFilter func(name string, value reflect.Value) bool

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/ast"  "reflect")
func main() {  var f ast.FieldFilter = func(n string, v reflect.Value) bool { return n == "Name" }  fmt.Println(f("Name", reflect.ValueOf("x")), f("Obj", reflect.ValueOf(0)))}
Go Reference