Golang go/ast.Ident.IsExported() function example
package go/ast
IsExported reports whether id is an exported Go symbol (that is, whether it begins with an uppercase letter).
Golang go/ast.Ident.IsExported() function usage example
func inspectFieldTag(f *File, node ast.Node) {
field := node.(*ast.Field)
if field.Tag == nil {
fmt.Println("Field tag empty")
return
}
if len(field.Names) == 0 {
fmt.Println("Field tag name empty")
return
}
if field.Names[0].IsExported() { // <-- here
fmt.Println("Field tag id is exported Go symbol")
return
}
}
Reference :
Advertisement
Something interesting
Tutorials
+5.4k How to check with curl if my website or the asset is gzipped ?
+8.9k Golang : What is the default port number for connecting to MySQL/MariaDB database ?
+8.4k Your page has meta tags in the body instead of the head
+10.6k Golang : ISO8601 Duration Parser example
+5.8k Golang : Fix opencv.LoadHaarClassifierCascade The node does not represent a user object error
+30.5k Get client IP Address in Go
+28k Golang : Move file to another directory
+7.5k Golang : Create zip/ePub file without compression(use Store algorithm)
+35.3k Golang : Strip slashes from string example
+18.4k Golang : How to remove certain lines from a file
+9.2k Golang : How to check if a string with spaces in between is numeric?
+5.8k Golang : Launching your executable inside a console under Linux