Standard library / go/ast

go/ast.NotNilFilter()

Field filter that omits nil-valued fields from AST diagnostic output. Expected stdout: 'false true\n'.

Formal Syntax & Structure

go syntaxgo
func NotNilFilter(_ string, v reflect.Value) bool

Parameters & Attributes

NameTypeDescription
_stringInput to the operation as described above.
vreflect.ValueVisitor or reflection value, depending on the API.

Return Value

bool

Field filter that omits nil-valued fields from AST diagnostic output.

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/ast"  "reflect")
func main() {  fmt.Println(ast.NotNilFilter("x", reflect.ValueOf((*int)(nil))), ast.NotNilFilter("x", reflect.ValueOf(3)))}
Go Reference