Standard library / reflect
reflect.Method.IsExported()
Report whether the method is exported. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (m Method) IsExported() boolReturn Value
bool
Report whether the method is exported.
Working Example
Example Snippetgo
package main
import ( "fmt" "reflect")
type Item struct{}
func (Item) Name() string { return "demo" }func main() { m, _ := reflect.TypeOf(Item{}).MethodByName("Name"); fmt.Println(m.IsExported()) }