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
+7.4k Golang : Hue, Saturation and Value(HSV) with OpenCV example
+11.1k Golang : Web routing/multiplex example
+7.3k Golang : Fixing Gorilla mux http.FileServer() 404 problem
+33.9k Golang : Call a function after some delay(time.Sleep and Tick)
+7.5k Golang : Get YouTube playlist
+11.2k CodeIgniter : How to check if a session exist in PHP?
+12.4k Golang : Search and extract certain XML data example
+21.1k Golang : Sort and reverse sort a slice of strings
+8.5k Android Studio : Import third-party library or package into Gradle Scripts
+22.4k Golang : How to read JPG(JPEG), GIF and PNG files ?
+15.2k JavaScript/JQuery : Detect or intercept enter key pressed example