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) boolParameters & Attributes
| Name | Type | Description |
|---|---|---|
| _ | string | Input to the operation as described above. |
| v | reflect.Value | Visitor 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)))}