Standard library / reflect
reflect.StructField.IsExported()
Report whether a struct field is exported, independently of whether a particular Value is settable. Expected stdout: 'true false\n'.
Formal Syntax & Structure
go syntaxgo
func (f StructField) IsExported() boolReturn Value
bool
Report whether a struct field is exported, independently of whether a particular Value is settable.
Working Example
Example Snippetgo
package main
import ( "fmt" "reflect")
func main() { type Row struct { X int y int } t := reflect.TypeOf(Row{}) fmt.Println(t.Field(0).IsExported(), t.Field(1).IsExported())}