Golang go/ast.FilterDecl() function example
package go/ast
FilterDecl trims the AST for a Go declaration in place by removing all names (including struct field and interface method names, but not from parameter lists) that don't pass through the filter f.
FilterDecl returns true if there are any declared names left after filtering; it returns false otherwise.
Golang go/ast.FilterDecl() function usage example
func filterFile(src *File, f Filter, export bool) bool {
j := 0
for _, d := range src.Decls {
if filterDecl(d, f, export) { // <-- here
src.Decls[j] = d
j++
}
}
src.Decls = src.Decls[0:j]
return j > 0
}
References :
Advertisement
Something interesting
Tutorials
+7.3k Golang : Of hash table and hash map
+13.1k Golang : Convert(cast) uintptr to string example
+10.2k Golang : Random Rune generator
+5.3k Swift : Convert string array to array example
+9.4k Golang : Launch Mac OS X Preview (or other OS) application from your program example
+6.9k Nginx : Password protect a directory/folder
+20.3k Swift : Convert (cast) Int to int32 or Uint32
+12.4k Elastic Search : Return all records (higher than default 10)
+12.8k Swift : Convert (cast) Int or int32 value to CGFloat
+34.6k Golang : How to stream file to client(browser) or write to http.ResponseWriter?
+8.6k Android Studio : Import third-party library or package into Gradle Scripts
+12.1k Golang : md5 hash of a string